English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

Redis Zrevrangebyscore Befehl

Redis Sorted Sets (sorted set)

Redis Zrevrangebyscore returns all members in the specified score range of the sorted set. The sorted set members are sorted in descending order (from large to small) by score value.

Members with the same score are sorted in reverse lexicographical order (reverse lexicographical order).

Other than members are sorted in descending order by score value, the ZREVRANGEBYSCORE command has the same aspects as ZRANGEBYSCORE Command is the same.

Syntax

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

List of members in the specified range, with optional score values.

Online 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  # In reverse order, all members
1)  "jack"
2)  "peter"
3)  "tom"
4)  "joe"
redis 127.0.0.1:6379>  ZREVRANGEBYSCORE salary 10000 2000  # In reverse order, salary between 10000 and 2000 between members
1)  "peter"
2)  "tom"
3)  "joe"

Redis Sorted Sets (sorted set)