# Array commands

> Commands for storing values in a sparse, index-addressed array.

An array stores string values under unsigned integer indexes, from `0` up to `18446744073709551614`. It is sparse: an index either holds a value or is empty, and writing to a distant index does not allocate the slots in between. Nothing shifts when a value is deleted, so an index keeps its meaning for the lifetime of the key. That makes an array the right shape for data that already has a natural numeric key, such as a sequence number or a bucketed timestamp, where a [list](/redis/commands/list/overview) would force a scan and a [hash](/redis/commands/hash/overview) would store the index as a string.

Two numbers describe an array and they are not the same. [`ARCOUNT`](/redis/commands/array/arcount) is how many slots hold a value; [`ARLEN`](/redis/commands/array/arlen) is the highest occupied index plus one. They agree only when the array is densely filled from `0`.

Each array also keeps an append cursor, holding the index the last append wrote to. [`ARINSERT`](/redis/commands/array/arinsert) appends after it, [`ARRING`](/redis/commands/array/arring) appends after it and wraps within a fixed number of slots, [`ARNEXT`](/redis/commands/array/arnext) reads where the next append will land, and [`ARSEEK`](/redis/commands/array/arseek) moves it. The cursor tracks appends only: positional writes with [`ARSET`](/redis/commands/array/arset) and deletions never move it, so a freed index is never silently reused.

<CardGroup cols={2}>
  <Card title="ARSET" href="/redis/commands/array/arset">
    Set contiguous array values from an index
  </Card>
  <Card title="ARMSET" href="/redis/commands/array/armset">
    Set values at several array indexes
  </Card>
  <Card title="ARGET" href="/redis/commands/array/arget">
    Get the value at an array index
  </Card>
  <Card title="ARMGET" href="/redis/commands/array/armget">
    Get the values at several array indexes
  </Card>
  <Card title="ARGETRANGE" href="/redis/commands/array/argetrange">
    Get array values in an index range
  </Card>
  <Card title="ARSCAN" href="/redis/commands/array/arscan">
    Scan the populated slots of an array
  </Card>
  <Card title="ARGREP" href="/redis/commands/array/argrep">
    Search array values with predicates
  </Card>
  <Card title="ARDEL" href="/redis/commands/array/ardel">
    Delete values at the given array indexes
  </Card>
  <Card title="ARDELRANGE" href="/redis/commands/array/ardelrange">
    Delete array values in one or more index ranges
  </Card>
  <Card title="ARCOUNT" href="/redis/commands/array/arcount">
    Count the values stored in an array
  </Card>
  <Card title="ARLEN" href="/redis/commands/array/arlen">
    Get the length of an array
  </Card>
  <Card title="ARINSERT" href="/redis/commands/array/arinsert">
    Append values to an array
  </Card>
  <Card title="ARRING" href="/redis/commands/array/arring">
    Append values to a fixed-size ring
  </Card>
  <Card title="ARLASTITEMS" href="/redis/commands/array/arlastitems">
    Read the most recently written array values
  </Card>
  <Card title="ARNEXT" href="/redis/commands/array/arnext">
    Get the index the next append will use
  </Card>
  <Card title="ARSEEK" href="/redis/commands/array/arseek">
    Move the array append cursor
  </Card>
  <Card title="AROP" href="/redis/commands/array/arop">
    Aggregate array values in an index range
  </Card>
  <Card title="ARINFO" href="/redis/commands/array/arinfo">
    Inspect the internal layout of an array
  </Card>
</CardGroup>
