Redis Zcard command
Redis ordered set (sorted set)
The number of elements in the collection Redis Zcard command is used to calculate.
grammar
redis Zcard basic command syntax is as follows:
redis 127.0.0.1:6379> ZCARD KEY_NAME
Available versions
> = 1.2.0
return value
When the key is present and is an ordered collection types, return cardinality ordered set. When the key does not exist, 0 is returned.
Examples
redis 127.0.0.1:6379> ZADD myset 1 "hello" (integer) 1 redis 127.0.0.1:6379> ZADD myset 1 "foo" (integer) 1 redis 127.0.0.1:6379> ZADD myset 2 "world" 3 "bar" (integer) 2 redis 127.0.0.1:6379> ZCARD myzset (integer) 4