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

Redis Zrevrange Command

Redis Sorted Sets (sorted set)

The Redis Zrevrange command returns members in the specified range of the sorted set.

The position of the member is arranged in descending order of score (from large to small).

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

Apart from the fact that members are sorted in descending order by score, the other aspects of the ZREVRANGE command are the same as ZRANGE is the same as the command.

Syntax

The basic syntax of the redis Zrevrange command is as follows:

redis 127.0.0.1:6379> ZREVRANGE key start stop [WITHSCORES]

Available Versions

>= 1.2.0

Return Values

List of members in the specified range with scores (optional).

Online Examples

redis 127.0.0.1:6379> ZRANGE salary 0 -1 WITHSCORES        # Increasing order
1) "peter"
2) "3500"
3) "tom"
4) "4000"
5) "jack"
6) "5000"
redis 127.0.0.1:6379> ZREVRANGE salary 0 -1 WITHSCORES     # Decreasing order
1) "jack"
2) "5000"
3) "tom"
4) "4000"
5) "peter"
6) "3500"

Redis Sorted Sets (sorted set)