Redis Zcard Command
The Redis Zcard command is used to count the number of elements in a sorted set.
Syntax
The basic syntax of the redis Zcard command is as follows:
redis 127.0.0.1:6379> ZCARD KEY_NAME
Available Versions
>= 1.2.0
Return Value
When the key exists and is of sorted set type, the cardinality of the sorted set is returned. When the key does not exist, 0 is returned.
Example
redis> ZADD myzset 1 "one" (integer) 1 redis> ZADD myzset 2 "two" (integer) 1 redis> ZCARD myzset (integer) 2 redis>
Other Extensions
