Use ARSEEK to set the index that the next ARINSERT will write to.
Appending normally continues from wherever the last append left off. ARSEEK overrides that, which is how a producer restarts a run at a known offset, or rewinds the cursor so that a region is rewritten rather than extended. Seeking to 0 returns the array to its never-appended state, so the next append goes to index 0.
Moving the cursor does not read, write, or delete any value, so seeking backward over occupied slots leaves them in place until an append overwrites them. The reply is 1 when the cursor was moved and 0 when the key does not exist.
See the array command overview for the data model these commands share.
Syntax#
Arguments#
| Argument | Required | Repeatable | Description |
|---|---|---|---|
<key> | Yes | No | Array key targeted by the command. |
<index> | Yes | No | Index that the next append should write to. |
Important points#
ARSEEKdoes not create the key. Seeking on a key that does not exist replies0and changes nothing.- The values already stored are left untouched; only the cursor moves.
Response#
The reply reports the result of the operation. Error replies have the same shape in RESP2 and RESP3 and are surfaced as exceptions by the SDKs below.
| Protocol | Reply |
|---|---|
| RESP2 | Integer |
| RESP3 | Integer |
Client libraries often decode bulk strings, maps, sets, and numeric strings into language-native values. The table describes the Redis wire reply.
Examples#
TCP examples use the TLS REDIS_URL from the Upstash console. REST examples use UPSTASH_REDIS_REST_URL and UPSTASH_REDIS_REST_TOKEN.
Redis CLI
@upstash/redis
This command is not supported yet in @upstash/redis.
upstash_redis
This command is not supported yet in upstash_redis.