Skip to main content
Use ARCOUNT to get the number of occupied slots in an array. This is the count of values actually stored, so holes left by ARDEL or by writing to scattered indexes are not counted. It is therefore different from ARLEN, which reports how far the array extends. For a densely filled array the two agree; for a sparse one, ARCOUNT is the smaller number and the one that tracks stored data. A key that does not exist counts as 0. See the array command overview for the data model these commands share.

Syntax

Arguments

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.