Skip to main content
Use ARMSET to write several index-value pairs into an array in one atomic call. Unlike ARSET, which fills a contiguous run from a starting index, ARMSET takes an explicit index for every value, so scattered slots can be updated together without a round trip each. The reply counts the slots that were newly occupied; pairs that overwrote an existing value contribute nothing to it. If the same index appears more than once in one call, the last value given for it wins. See the array command overview for the data model these commands share.

Syntax

Arguments

Important points

  • The number of arguments after the key must be even; an odd count returns a wrong number of arguments error.
  • The reply counts newly occupied slots only. Overwriting an existing value contributes 0.

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.
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.
This command is not supported yet in @upstash/redis.
This command is not supported yet in upstash_redis.