English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
Redis Sorted Sets (sorted set)
Redis Zrevrangebyscore returns all members within the specified score range of the sorted set. The sorted set members are arranged in descending order (from largest to smallest) by score value.
Members with the same score are arranged in reverse lexicographical order.
Apart from the fact that members are arranged in descending order of score value, the other aspects of the ZREVRANGEBYSCORE command are the same as ZRANGEBYSCORE is the same as the command.
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]
>= 2.2.0
List of sorted set members within a specified range, with optional score values.
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 # In reverse order by all members 1) "jack" 2) "peter" 3) "tom" 4) "joe" redis 127.0.0.1:6379> ZREVRANGEBYSCORE salary 10000 2000 # In reverse order by salary between 10000 and 2members between 000 1) "peter" 2) "tom" 3) "joe"