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