zrangestore.3valkey - Man Page

Stores a range of members from sorted set in a key.

Synopsis

ZRANGESTORE dst src min max [BYSCORE | BYLEX] [REV] [LIMIT offset count]

Description

This command is like ZRANGE, but stores the result in the <dst> destination key.

Reply

valkey-protocol(7) Integer reply: the number of elements in the resulting sorted set.

Complexity

O(log(N)+M) with N being the number of elements in the sorted set and M the number of elements stored into the destination key.

Acl Categories

@slow @sortedset @write

History

Examples

127.0.0.1:6379> ZADD srczset 1 "one" 2 "two" 3 "three" 4 "four"
(integer) 4
127.0.0.1:6379> ZRANGESTORE dstzset srczset 2 -1
(integer) 2
127.0.0.1:6379> ZRANGE dstzset 0 -1
1) "three"
2) "four"

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), zrank(3valkey), zrem(3valkey), zremrangebylex(3valkey), zremrangebyrank(3valkey), zremrangebyscore(3valkey), zrevrank(3valkey), zscan(3valkey), zscore(3valkey), zunion(3valkey), zunionstore(3valkey)

Info

2024-09-23 8.0.0 Valkey Command Manual