ZREVRANK
Introduction
In Dragonfly, as well as in Redis and Valkey, the ZREVRANK command is used to determine the rank of a member in a sorted set, with the scores ordered from high to low.
The rank is counted starting from 0, where 0 is the highest score.
This command is useful when you want to rank items such as user scores or product ratings in descending order.
Syntax
ZREVRANK key member
- Time complexity: O(log(N))
- ACL categories: @read, @sortedset, @fast
Parameter Explanations
key: The key of the sorted set.member: The value whose rank you want to retrieve in the sorted set.
Return Values
- The command returns the rank of the member in the sorted set, with rank
0being the highest. - If the member does not exist, the command returns
nil.