ZREVRANGEBYLEX

Apply for Redis Developer Course Redis Regular Inspection / Technical Support Redis Enterprise Server

Query members in reverse lexicographical order (from largest)

Usage: zrevrangebylex key max min.
max and min are member bounds. Use +, - to query all members.
When specifying values for max/min, prefix them with [ or (.
Use [ to include the value and ( to exclude it.
This command requires all scores to be equal to get the intended result.
This command has no withscores option.

Example

Command>zrevrangebylex city + -
Result> 0) Seoul
1) New York
2) New Delhi
3) Beijing
Command>zrevrangebylex city + "[New Delhi"
Result> 0) Seoul
1) New York
2) New Delhi
Command>zrevrangebylex city "(Seoul" "[New Delhi"
Result> 0) New York
1) New Delhi
Command>zrevrangebylex city "(Seoul" "(New Delhi"
Result> 0) New York

View animation


Using limit offset count

Usage: zrevrangebylex key max minlimit offset count.
offset is the starting point, and count is the number of members to return.
offset can start from 0, and count must be 1 or greater. If count is 0, nothing is returned.
If limit is used, both offset and count are required.
Useful for paging.<

Example

Command>zrevrangebylex city + -limit 0 2
Result> 0) Seoul
1) New York
Command>zrevrangebylex city - + limit 2 2
Result> 0) New Delhi
1) Beijing

View animation



Syntax

ZREVRANGEBYLEX key max min [limit offset count]

  • Available since version 2.8.9.
  • Time complexity is O(log(N)+M). N is the number of members in the set, and, M is the number of members to delete.
Related commands ZRANGE, ZREVRANGE, ZREVRANGEBYSCORE, LRANGE
Clients for Java Jedis, Lettuce, Redisson
Clients for C Hiredis

<< ZRANGEBYLEX ZREVRANGEBYLEX ZCARD >>

Email 답글이 올라오면 이메일로 알려드리겠습니다.