YouTip LogoYouTip

Sorted Sets Zrevrangebyscore

Redis Zrevrangebyscore Command

-- Learning is not just technology, but also dreams!

Redis Tutorial

Redis TutorialRedis IntroductionRedis InstallationRedis ConfigurationRedis Data Types

Redis Commands

Redis CommandsRedis KeysRedis StringsRedis HashRedis ListRedis SetRedis Sorted SetRedis HyperLogLogRedis Publish SubscribeRedis TransactionsRedis ScriptingRedis ConnectionRedis ServerRedis GEORedis Stream

Redis Advanced Tutorial

Redis Data Backup and RecoveryRedis SecurityRedis Performance TestingRedis Client ConnectionRedis PipeliningRedis PartitioningJava Using RedisPHP Using Redis

Redis Zrevrange Command

Redis Zrevrank Command

Deep Exploration

Programming

Data Management

Network Design and Development

Software

Computer Science

Programming Languages

Scripting

Scripting Languages

Network Services

Web Service

Redis Zrevrangebyscore Command

Redis Sorted Set

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

Members with the same score value are arranged in reverse lexicographical order.

Except for arranging members in descending order by score value, other aspects of the ZREVRANGEBYSCORE command are the same as the ZRANGEBYSCORE command.

Syntax

Redis Zrevrangebyscore command basic syntax is as follows:

redis 127.0.0.1:6379> ZREVRANGEBYSCORE key max min  

Available Version

>= 2.2.0

Return Value

A list of sorted set members with score values (optional) in the specified range.

Example

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

Redis Sorted Set

← Sorted Sets ZrevrankSorted Sets Zrevrange β†’