ZCARD

ZCARD key
Available since:
Redis Open Source 1.2.0
Time complexity:
O(1)
ACL categories:
@read, @sortedset, @fast,
Compatibility:
Redis Software and Redis Cloud compatibility

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

Required arguments

key

The name of the key that holds the sorted set.

Examples

ZADD myzset 1 "one" ZADD myzset 2 "two" ZCARD myzset

Redis Software and Redis Cloud compatibility

Redis
Software
Redis
Cloud
Notes
✅ Standard
✅ Active-Active
✅ Standard
✅ Active-Active

Return information

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 ↑