Redis Zrevrangebyscore Command
Redis Zrevrangebyscore returns all members in the sorted set within the specified score range. The sorted set members are arranged in descending order of score value (from largest to smallest).
Members with the same score value are arranged in reverse lexicographical order.
Except that members are arranged in descending order of score value, other aspects of the ZREVRANGEBYSCORE command are the same asZRANGEBYSCOREthe command.
Syntax
The basic syntax of the redis Zrevrangebyscore command is as follows:
redis 127.0.0.1:6379> ZREVRANGEBYSCORE key max min [WITHSCORES] [LIMIT offset count]
Available versions
>= 2.2.0
Return value
A list of sorted set members with their scores (optional) within the specified range.
Examples
redis 127.0.0.1:6379> ZADD salary 10086 jack (integer) 1 redis > ZADD salary 5000 tom (integer) 1 redis 127.0.0.1:6379> ZADD salary 7500 peter (integer) 1 redis 127.0.0.1:6379> ZADD salary 3500 joe (integer) 1 redis 127.0.0.1:6379> ZREVRANGEBYSCORE salary +inf -inf # 逆序排列所有成员 1) "jack" 2) "peter" 3) "tom" 4) "joe" redis 127.0.0.1:6379> ZREVRANGEBYSCORE salary 10000 2000 # 逆序排列薪水介于 10000 和 2000 之间的成员 1) "peter" 2) "tom" 3) "joe"
Other extensions
