Redis Zcount Command
The Redis Zcount command is used to count the number of members in a sorted set with scores within the specified range.
Syntax
The basic syntax of the redis Zcount command is as follows:
redis 127.0.0.1:6379> ZCOUNT key min max
Available Versions
>= 2.0.0
Return Value
The number of members whose score values are between min and max.
Example
redis 127.0.0.1:6379> ZADD myzset 1 "hello" (integer) 1 redis 127.0.0.1:6379> ZADD myzset 1 "foo" (integer) 1 redis 127.0.0.1:6379> ZADD myzset 2 "world" 3 "bar" (integer) 2 redis 127.0.0.1:6379> ZCOUNT myzset 1 3 (integer) 4
Other Extensions
