Sorted Set
ZLEXCOUNT
Returns the number of elements in the sorted set stored at key filterd by lex.
await redis.zadd("key",
{ score: 1, member: "one"},
{ score: 2, member: "two" },
);
const elements = await redis.zlexcount("key", "two", "+");
console.log(elements); // 1
Arguments
key
string
requiredThe key to get.
min
string
requiredThe lower lexicographical bound to filter by.
Use -
to disable the lower bound.
max
string
requiredThe upper lexicographical bound to filter by.
Use +
to disable the upper bound.
Response
The number of matched.
Was this page helpful?
await redis.zadd("key",
{ score: 1, member: "one"},
{ score: 2, member: "two" },
);
const elements = await redis.zlexcount("key", "two", "+");
console.log(elements); // 1