ZLEXCOUNT

Since 1.1.0Sorted sets

Syntax

ZLEXCOUNT key min max
  • Flags: fast, readonly
  • ACL categories: @fast, @read, @sortedset
  • Arity: 4

Counts the members of the sorted set at key between min and max in lexicographical order. It is meant for sets whose members all have the same score. A bound starts with [ (included) or ( (excluded); - and + are the open ends.

Reply

  • The count.
  • ERR min or max not valid string range item if a bound has no [ or (.

Examples

> ZADD lx 0 apple 0 banana 0 cherry 0 date
(integer) 4
> ZLEXCOUNT lx [b [d
(integer) 2