Mzdiffstore
Bun

method

RedisClient.zdiffstore

destination: KeyLike,
numkeys: number,
...keys: KeyLike[]
): Promise<number>;

Compute the difference between sorted sets and store the result

Computes the difference between the first and all successive sorted sets given by the specified keys and stores the result in destination. Keys that do not exist are considered to be empty sets.

@param destination

The destination key to store the result

@param numkeys

The number of input sorted set keys

@param keys

The sorted set keys to compare

@returns

Promise that resolves with the number of elements in the resulting sorted set

await redis.send("ZADD", ["zset1", "1", "one", "2", "two", "3", "three"]);
await redis.send("ZADD", ["zset2", "1", "one"]);
const count = await redis.zdiffstore("out", 2, "zset1", "zset2");
console.log(count); // 2 (two, three)

Referenced types

type KeyLike = string | ArrayBufferView | Blob