ARSCAN
ARSCAN key start end [LIMIT limit]
- Available since:
- Redis Open Source 8.8.0
- Time complexity:
- O(P) where P is visited positions in touched slices (dense scanned slots + sparse entries), with worst-case O(|end-start|+1) and typical case close to O(N), where N is the number of existing elements in range.
- ACL categories:
-
ARRAY,
Iterates existing elements in a range, returning index-value pairs.
Required arguments
key
The name of the key that holds the array.
start
The zero-based integer index at which to begin scanning. If start is greater than end, elements are returned in reverse index order.
end
The zero-based integer index at which to stop scanning (inclusive).
Optional arguments
LIMIT
The maximum number of index-value pairs to return. When omitted, all elements in the range are returned. Unlike ARGETRANGE, empty slots are not included in the output, so LIMIT caps the number of existing elements returned.
Examples
Return information
Array reply: Flat array of index-value pairs: [idx1, val1, idx2, val2, ...]