ARGETRANGE
ARGETRANGE key start end
- Available since:
- Redis Open Source 8.8.0
- Time complexity:
- O(N) where N is the range length
- ACL categories:
-
@read,@array,@slow, - Compatibility:
- Redis Software and Redis Cloud compatibility
Gets values in a range of indices.
Required arguments
key
The name of the key that holds the array.
start
The zero-based integer index of the first element to return. If start is greater than end, elements are returned in reverse index order.
end
The zero-based integer index of the last element to return (inclusive). If end is less than start, elements are returned in reverse index order.
Examples
redis> ARMSET myarray 0 "a" 1 "b" 3 "d" (integer) 3 redis> ARGETRANGE myarray 0 3 1) "a" 2) "b" 3) (nil) 4) "d" redis> ARGETRANGE myarray 3 0 1) "d" 2) (nil) 3) "b" 4) "a"
Redis Software and Redis Cloud compatibility
| Redis Software |
Redis Cloud |
Notes |
|---|---|---|
| ❌ Standard |
❌ Standard |