ZCOUNT
Syntax
Section titled “Syntax”ZCOUNT key min max
ZCOUNT counts the number of members in a sorted set between min and max (both inclusive)
If you want to use unbounded ranges, use -inf and +inf for min and max respectively. The command returns the count of members in a sorted set between min and max (both inclusive). Returns 0 if the key does not exist.
Examples
Section titled “Examples”localhost:7379> ZADD k 10 k1OK 1localhost:7379> ZADD k 20 k2OK 1localhost:7379> ZADD k 30 k3OK 1localhost:7379> ZCOUNT k 10 20OK 2localhost:7379> ZCOUNT k 10 30OK 3localhost:7379> ZCOUNT k 10 40OK 3localhost:7379> ZCOUNT k 1 2OK 0localhost:7379> ZCOUNT k -inf +infOK 3localhost:7379> ZCOUNT k 10 10OK 1