ZCARD

ZCARD key

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

Return value

Integer reply: the cardinality (number of elements) of the sorted set, or 0 if key does not exist.

Examples

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

© 2009–2020 Salvatore Sanfilippo
Licensed under the Creative Commons Attribution-ShareAlike License 4.0.
https://redis.io/commands/zcard