ZREVRANGEBYLEX Deprecated

As of Redis version 6.2.0, this command is regarded as deprecated.

It can be replaced by ZRANGE with the REV and BYLEX arguments when migrating or writing new code.

ZREVRANGEBYLEX key max min [LIMIT offset count]
Available since:
Redis Open Source 2.8.9
Time complexity:
O(log(N)+M) with N being the number of elements in the sorted set and M the number of elements being returned. If M is constant (e.g. always asking for the first 10 elements with LIMIT), you can consider it O(log(N)).
ACL categories:
@read, @sortedset, @slow,
Compatibility:
Redis Software and Redis Cloud compatibility

When all the elements in a sorted set are inserted with the same score, in order to force lexicographical ordering, this command returns all the elements in the sorted set at key with a value between max and min.

Apart from the reversed ordering, ZREVRANGEBYLEX is similar to ZRANGEBYLEX.

Required arguments

key

The name of the key that holds the sorted set.

max

The maximum member, compared lexicographically. Prefix with [ for an inclusive bound or ( for an exclusive bound; use + for the highest possible value.

min

The minimum member, compared lexicographically. Prefix with [ for an inclusive bound or ( for an exclusive bound; use - for the lowest possible value.

Optional arguments

LIMIT offset count

Skip offset matching members and return up to count of them. A negative count returns all remaining members.

Examples

ZADD myzset 0 a 0 b 0 c 0 d 0 e 0 f 0 g ZREVRANGEBYLEX myzset [c - ZREVRANGEBYLEX myzset (c - ZREVRANGEBYLEX myzset (g [aaa

Redis Software and Redis Cloud compatibility

Redis
Software
Redis
Cloud
Notes
✅ Standard
✅ Active-Active
✅ Standard
✅ Active-Active
Deprecated as of Redis v6.2.0.

Return information

Array reply: a list of members in the specified score range.
RATE THIS PAGE
Back to top ↑