ZRANGESTORE · Valkey

ZRANGESTORE

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

Usage

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

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

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"

History

See also

BZMPOP, BZPOPMAX, BZPOPMIN, ZADD, ZCARD, ZCOUNT, ZDIFF, ZDIFFSTORE, ZINCRBY, ZINTER, ZINTERCARD, ZINTERSTORE, ZLEXCOUNT, ZMPOP, ZMSCORE, ZPOPMAX, ZPOPMIN, ZRANDMEMBER, ZRANGE, ZRANK, ZREM, ZREMRANGEBYLEX, ZREMRANGEBYRANK, ZREMRANGEBYSCORE, ZREVRANK, ZSCAN, ZSCORE, ZUNION, ZUNIONSTORE.