zrevrangebylex.3valkey - Man Page
Returns members in a sorted set within a lexicographical range in reverse order.
Synopsis
ZREVRANGEBYLEX
key max min [LIMIT
offset count]
Description
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
.
Reply
Resp2
valkey-protocol(7) Array reply: a list of members in the specified score range.
Resp3
valkey-protocol(7) Array reply: List of the elements in the specified score range.
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 @slow @sortedset
History
- Available since: 2.8.9
Notes
This command is deprecated (since 6.2.0) and replaced by ZRANGE
with the REV
and BYLEX
arguments.
Examples
127.0.0.1:6379> ZADD myzset 0 a 0 b 0 c 0 d 0 e 0 f 0 g (integer) 7 127.0.0.1:6379> ZREVRANGEBYLEX myzset [c - 1) "c" 2) "b" 3) "a" 127.0.0.1:6379> ZREVRANGEBYLEX myzset (c - 1) "b" 2) "a" 127.0.0.1:6379> ZREVRANGEBYLEX myzset (g [aaa 1) "f" 2) "e" 3) "d" 4) "c" 5) "b"
See Also
bzmpop(3valkey), bzpopmax(3valkey), bzpopmin(3valkey), zadd(3valkey), zcard(3valkey), zcount(3valkey), zdiff(3valkey), zdiffstore(3valkey), zincrby(3valkey), zinter(3valkey), zintercard(3valkey), zinterstore(3valkey), zlexcount(3valkey), zmpop(3valkey), zmscore(3valkey), zpopmax(3valkey), zpopmin(3valkey), zrandmember(3valkey), zrange(3valkey), zrangestore(3valkey), zrank(3valkey), zrem(3valkey), zremrangebylex(3valkey), zremrangebyrank(3valkey), zremrangebyscore(3valkey), zrevrank(3valkey), zscan(3valkey), zscore(3valkey), zunion(3valkey), zunionstore(3valkey)