method

RedisClient.lcs

key1: KeyLike,
key2: KeyLike,
...options: string | number[]
): Promise<any>;

Find the longest common subsequence between two string values

@param key1

The first key

@param key2

The second key

@param options

Optional LEN, IDX, MINMATCHLEN, WITHMATCHLEN modifiers

@returns

Promise that resolves with the LCS (string), its length (number), or match details

await redis.set("key1", "ohmytext");
await redis.set("key2", "mynewtext");
await redis.lcs("key1", "key2"); // "mytext"
await redis.lcs("key1", "key2", "LEN"); // 6

Referenced types

type KeyLike = string | ArrayBufferView | Blob