ZCARD key
相关命令
- ZADD
- ZCARD
- ZCOUNT
- ZINCRBY
- ZINTERSTORE
- ZLEXCOUNT
- ZRANGE
- ZRANGEBYLEX
- ZRANGEBYSCORE
- ZRANK
- ZREM
- ZREMRANGEBYLEX
- ZREMRANGEBYRANK
- ZREMRANGEBYSCORE
- ZREVRANGE
- ZREVRANGEBYSCORE
- ZREVRANK
- ZSCAN
- ZSCORE
- ZUNIONSTORE
Available since 1.2.0.
时间复杂度: O(1)
Returns the sorted set cardinality (number of elements) of the sorted set stored at key
.
返回值
Integer reply: the cardinality (number of elements) of the sorted set, or 0
if key
does not exist.
例子
redis> ZADD myzset 1 "one"
- (integer) 1
redis> ZADD myzset 2 "two"
- (integer) 1
redis> ZCARD myzset
- (integer) 2
This website is open source software developed by Citrusbyte.
The Redis logo was designed by Carlos Prioglio. See more credits.