ZREVRANK key member
Determines the index of a member in a sorted set, with scores ordered from high to low.
Redis ZREVRANK command returns the rank of the member in the sorted set stored at the key, with the scores ordered from high to low.
Note:
The rank (or index) is 0-based, which means that the member with the highest score has a rank of 0.
RETURN VALUE
If the member exists in the sorted set, Integer reply − the rank of the member.
If the member does not exist in the sorted set or the key does not exist, Bulk string reply − nil.
Syntax:
ZREVRANK key member
Example 1: When the member exists.
redis:6379> ZADD mykey 0 A 2 C 3 D 1 E(integer) 4redis:6379> ZREVRANK mykey A(integer) 3
Output
3
Example 2: When the member does not exists.
redis:6379> ZADD mykey 0 A 2 C 3 D 1 E(integer) 4redis:6379> ZREVRANK mykey AA(nil)
Output
nil
No comments:
Post a Comment