ZRANK key member
相关命令
- ZADD
 - ZCARD
 - ZCOUNT
 - ZINCRBY
 - ZINTERSTORE
 - ZLEXCOUNT
 - ZRANGE
 - ZRANGEBYLEX
 - ZRANGEBYSCORE
 - ZRANK
 - ZREM
 - ZREMRANGEBYLEX
 - ZREMRANGEBYRANK
 - ZREMRANGEBYSCORE
 - ZREVRANGE
 - ZREVRANGEBYSCORE
 - ZREVRANK
 - ZSCAN
 - ZSCORE
 - ZUNIONSTORE
 
Available since 2.0.0.
时间复杂度: O(log(N))
Returns the rank of member in the sorted set stored at key, with the scores ordered from low to high. The rank (or index) is 0-based, which means that the member with the lowest score has rank 0.
Use ZREVRANK to get the rank of an element with the scores ordered from high to low.
返回值
- If 
memberexists in the sorted set, Integer reply: the rank ofmember. - If 
memberdoes not exist in the sorted set orkeydoes not exist, Bulk string reply:nil. 
例子
redis> ZADD myzset 1 "one"
- (integer) 1
 
redis> ZADD myzset 2 "two"
- (integer) 1
 
redis> ZADD myzset 3 "three"
- (integer) 1
 
redis> ZRANK myzset "three"
- (integer) 2
 
redis> ZRANK myzset "four"
- (nil)
 
This website is open source software developed by Citrusbyte.
The Redis logo was designed by Carlos Prioglio. See more credits.
 
 