ARSET

ARSET key index value [value ...]
Available since:
Redis Open Source 8.8.0
Time complexity:
O(N) where N is the number of values
ACL categories:
@write, @array, @fast,
Compatibility:
Redis Software and Redis Cloud compatibility

Sets one or more contiguous values starting at an index in an array.

Required arguments

key

The name of the key that holds the array.

index

The zero-based integer index at which to start writing. When multiple values are provided, they are stored at consecutive indices starting from index.

value

One or more string values to store at consecutive indices beginning at index. The number of new (previously empty) slots filled is returned.

Examples

ARSET myarray 0 "hello" ARGET myarray 0 ARSET myarray 2 "a" "b" "c" ARGET myarray 2 ARGET myarray 4

Redis Software and Redis Cloud compatibility

Redis
Software
Redis
Cloud
Notes
❌ Standard
❌ Active-Active
❌ Standard
❌ Active-Active

Return information

Integer reply: Number of new slots that were set (previously empty).
RATE THIS PAGE
Back to top ↑