redis ZREVRANK command
Translation results:
rev
英[rev] 美[rɛv]
n.<口>The rotation of the engine
vt.& vi .<口> (to cause) to accelerate; (to cause an increase in quantity, activity, etc.); (to make an engine) rotate rapidly; (to make) active
Third person singular: revs Plural: revs Present participle: revving past Formula: revved past participle: revved
rank
英[ræŋk] 美[ræŋk]
n. Military rank; class, level; order, Sequence; row and row
vt.& vi. Arrange, make horizontal row; classify...
vt. Arrange; exceed, be higher than; rank... .Located in; arranged horizontally; complaining; nitpicking, exposing wounds
adj. annoying; extreme; lush; stinky
Third person singular: ranks plural: ranks present participle: ranking past tense: ranked past participle: ranked comparative: ranker superlative: rankest
redis ZREVRANK commandsyntax
Function: Returns the ranking of member in the ordered set key. The members of the ordered set are sorted by decreasing score value (from large to small).
Syntax: ZREVRANK key member
Description: The ranking is based on 0, that is to say, the member with the largest score value is ranked 0. Use the ZRANK command to get the ranking of members in ascending order of score value (from small to large).
Available versions: >= 2.0.0
Time complexity: O(log(N))
Return: If member is a member of the ordered set key, return the ranking of member. If member is not a member of the ordered set key, return nil.
redis ZREVRANK commandexample
redis 127.0.0.1:6379> ZRANGE salary 0 -1 WITHSCORES # 测试数据 1) "jack" 2) "2000" 3) "peter" 4) "3500" 5) "tom" 6) "5000" redis> ZREVRANK salary peter # peter 的工资排第二 (integer) 1 redis> ZREVRANK salary tom # tom 的工资最高 (integer) 0