Redis Sorted Sets: ZREVRANK
ZREVRANK key member
Redis ZREVRANK command is used to return the rank of member in the sorted set stored at key, with the scores ordered from high to low. The rank is 0-based, which means that the member with the highest score has rank 0.
Syntax:
ZREVRANK key member
Available since
2.0.0.
Return Value
- If a member exists in the sorted set, Integer reply: the rank of the member.
- If a member does not exist in the sorted set or key does not exist, Bulk string reply: nil.
Return Value Type
Integer
Example: Redis ZREVRANK
127.0.0.1:6379> ZADD mycityset 80 Delhi 60 Mumbai 70 Hyderabad 50 Kolkata 65 Chennai (integer) 5 127.0.0.1:6379> ZREVRANGE mycityset 0 -1 WITHSCORES 1) "Delhi" 2) "80" 3) "Hyderabad" 4) "70" 5) "Chennai" 6) "65" 7) "Mumbai" 8) "60" 9) "Kolkata" 10) "50" 127.0.0.1:6379> ZREVRANK mycityset Hyderabad (integer) 1 127.0.0.1:6379> ZREVRANK mycityset Kolkata (integer) 4
Previous:
ZREVRANGEBYSCORE
Next:
ZSCORE
- Weekly Trends and Language Statistics
- Weekly Trends and Language Statistics