redis ZREVRANGE 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
range
英[reɪndʒ] 美[rendʒ]
n. Range; range; category; (mountain range , houses, etc.) arrangement
vi. Search; change; extend; roam
vt. Arrange; (according to a certain position or order) sort; classify...; wander
adj. Pasture, grazing area
Third person singular: ranges Plural: ranges Present participle: ranging Past tense: ranged Past participle: ranged
redis ZREVRANGE commandsyntax
Function: Returns the members in the specified range in the ordered set key.
Syntax: ZREVRANGE key start stop [WITHSCORES]
Description: The position of the members is determined by the score value in descending order (from large to small) arrangement. Members with the same score value are arranged in reverse lexicographical order. The ZREVRANGE command is identical to the ZRANGE command except that members are arranged in descending order of score value.
Available versions: >= 1.2.0
Time complexity: O(log(N) M), N is ordered The cardinality of the set, and M is the cardinality of the result set.
Returns: A list of ordered set members with score value (optional) in the specified interval.
redis ZREVRANGE commandexample
redis> ZRANGE salary 0 -1 WITHSCORES # 递增排列 1) "peter" 2) "3500" 3) "tom" 4) "4000" 5) "jack" 6) "5000" redis> ZREVRANGE salary 0 -1 WITHSCORES # 递减排列 1) "jack" 2) "5000" 3) "tom" 4) "4000" 5) "peter" 6) "3500"