Redis zrevrank Command
Redis ordered set (sorted set)
The Redis zrevrank command returns the rank of the member in the ordered set. Where ordered set members are sorted by fractional values descending (from large to small).
The ranking is based on 0, that is, the member with the highest number of points is ranked at 0.
Use the Zrank command to get the ranking of members in ascending (small to large) increments of fractional values. Grammar
The basic syntax for the Redis zrevrank command is as follows:
Redis 127.0.0.1:6379> Zrevrank Key Member
Available versions
>= 2.2.0 return value
Returns the rank of a member if the member is a member of an ordered set key. Returns nil if the member is not a member of the ordered set key. Example
Redis 127.0.0.1:6379> zrange Salary 0-1 withscores # test Data
1) "Jack"
2) "3" "
Peter"
4) "3500 "
5" "Tom"
6) "127.0.0.1:6379>"
Redis Zrevrank salary Peter # Peter's payroll Second
(integer) 1
Redis 127.0.0.1:6379> Zrevrank salary Tom # Tom's highest salary
(integer) 0
Redis ordered set (sorted set)