English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

Redis Zrank Command

Redis Sorted Sets (sorted set)

Redis Zrank returns the ranking of the specified member in the ordered set. The members of the ordered set are arranged in ascending order of score value (from small to large).

= 2.0.0

Return Value

If the member is a member of the ordered set key, return the ranking of the member. If the member is not a member of the ordered set key, return nil .

Online Examples

redis 127.0.0.1:6379> ZRANGE salary 0 -1 WITHSCORES                                                                           # Display all members and their score values
1) "peter"
2) "3500"
3) "tom"
4) "4000"
5) "jack"
6) "5000"
redis 127.0.0.1:6379> ZRANK salary tom                                                                         # Display the salary ranking of tom, second
(integer) 1

Redis Sorted Sets (sorted set)