Use ARDEL to empty one or more array slots.
Deleting a slot leaves a hole rather than shifting later values down, so every other index keeps its meaning. The reply counts the slots that actually held a value, so indexes that were already empty do not inflate it. Removing the last remaining value deletes the key.
Deletion does not move the append cursor: ARNEXT still reports the slot after the highest index ever appended, so an ARINSERT will not silently reuse a freed index.
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 | Yes | Zero-based index to clear. Repeat to clear several slots in one call. |
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.