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
Redis Software and Redis Cloud compatibility
| Redis Software |
Redis Cloud |
Notes |
|---|---|---|
| ✅ Standard |
✅ Standard |
Return information
Integer reply: the number of elements in the resulting sorted set.