YouTip LogoYouTip

Sorted Sets Zrevrank

# Redis Zrevrank Command * (javascript:void(0);) * (javascript:void(0);) * (javascript:void(0);) * (javascript:void(0)) Redis Tutorial (#)(#)(#)(#)(#) ## Redis Commands (#)(#)(#)(#)(#)(#)(#)(#)[Redis Pub/Sub](#)(#)(#)(#)(#)(#)(#) ## Redis Advanced Tutorial (#)(#)(#)(#)(#)(#)(#)(#) [](#)(#) (#)[](#) # Redis Zrevrank Command !(#)(#) The Redis ZREVRANK command returns the rank of a member in a sorted set, with scores ordered from high to low. Ranks are zero-based, meaning the member with the highest score has rank 0. Use the ZRANK command to get the rank of a member with scores ordered from low to high. ### Syntax The basic syntax for the Redis ZREVRANK command is as follows: redis 127.0.0.1:6379> ZREVRANK key member ### Available since >= 2.2.0 ### Return value If the member exists in the sorted set, its rank is returned. If the member does not exist in the sorted set, nil is returned. ### Example redis 127.0.0.1:6379> ZRANGE salary 0 -1 WITHSCORES # Test data1) "jack"2) "2000"3) "peter"4) "3500"5) "tom"6) "5000" redis 127.0.0.1:6379> ZREVRANK salary peter # peter's salary ranks second(integer) 1 redis 127.0.0.1:6379> ZREVRANK salary tom # tom has the highest salary(integer) 0 !(#)(#)
← Redis HyperloglogSorted Sets Zrevrangebyscore β†’