ARRING
ARRING key size value [value ...]
- Available since:
- Redis Open Source 8.8.0
- Time complexity:
- O(M) normally, O(N+M) on ring resize, where N is the maximum of the old and new ring size and M is the number of inserted values
- ACL categories:
-
ARRAY,
Inserts values into a ring buffer of specified size, wrapping and truncating as needed.
Required arguments
key
The name of the key that holds the array.
size
The size of the ring buffer window. Each value is inserted at insert_idx % size, wrapping back to index 0 when the end of the window is reached. When the buffer is full, newer values overwrite older ones. If size is smaller than the current window, the array is truncated to fit.
value
One or more string values to insert into the ring buffer. Each value is placed at the next position in the ring and the cursor advances accordingly.
Examples
Return information
Integer reply: The last index where a value was inserted.