ZRANGESTORE

ZRANGESTORE dst src min max [BYSCORE | BYLEX] [REV] [LIMIT offset
  count]
Available since:
Redis Open Source 6.2.0
Time 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:
@write, @sortedset, @slow,
Compatibility:
Redis Software and Redis Cloud compatibility
Note:
This command's behavior varies in clustered Redis environments. See the multi-key operations page for more information.

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

Required arguments

dst

The key to store the resulting sorted set in.

src

The source sorted-set key.

min

The start of the range. By default a zero-based index (negatives count from the end); a score bound with BYSCORE; or a lexicographical bound with BYLEX.

max

The end of the range, inclusive. Interpreted the same way as min.

Optional arguments

BYSCORE | BYLEX

Interpret the range as a score range (BYSCORE) or a lexicographical range (BYLEX) instead of an index range.

REV

Reverse the ordering so results are returned from high to low.

LIMIT offset count

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

Examples

ZADD srczset 1 "one" 2 "two" 3 "three" 4 "four" ZRANGESTORE dstzset srczset 2 -1 ZRANGE dstzset 0 -1

Redis Software and Redis Cloud compatibility

Redis
Software
Redis
Cloud
Notes
✅ Standard
✅ Active-Active
✅ Standard
✅ Active-Active

Return information

Integer reply: the number of elements in the resulting sorted set.
RATE THIS PAGE
Back to top ↑