ZCARD

Syntax
ZCARD key
Available since:
1.2.0
Time complexity:
O(1)
ACL categories:
@read, @sortedset, @fast,

Returns the sorted set cardinality (number of elements) of the sorted set stored at key.

Examples

redis> ZADD myzset 1 "one"
(integer) 1
redis> ZADD myzset 2 "two"
(integer) 2
redis> ZCARD myzset
(integer) 3
redis>

RESP2/RESP3 Reply

Integer reply: the cardinality (number of members) of the sorted set, or 0 if the key doesn't exist.
RATE THIS PAGE
Back to top ↑