{
  "schema_version": 2,
  "id": "commands/arlastitems",
  "title": "ARLASTITEMS",
  "url": "https://redis.io/docs/latest/commands/arlastitems/",
  "summary": "Returns the most recently inserted elements.",
  "since": "8.8.0",
  "tags": [
    "docs",
    "develop",
    "stack",
    "oss",
    "rs",
    "rc",
    "oss",
    "kubernetes",
    "clients"
  ],
  "last_updated": "2026-07-24T11:07:00+02:00",
  "page_type": "content",
  "content_hash": "f238d480d114f89fa6dbbaeb159a2743285e1277437013257028fdf02929a163",
  "sections": [
    {
      "id": "overview",
      "title": "Overview",
      "role": "overview",
      "text": "Returns the most recently inserted elements."
    },
    {
      "id": "required-arguments",
      "title": "Required arguments",
      "role": "content",
      "text": "<details open><summary><code>key</code></summary>\n\nThe name of the key that holds the array.\n\n</details>\n\n<details open><summary><code>count</code></summary>\n\nThe maximum number of most recently inserted elements to return. If the array contains fewer elements than `count`, all elements are returned.\n\n</details>"
    },
    {
      "id": "optional-arguments",
      "title": "Optional arguments",
      "role": "parameters",
      "text": "<details open><summary><code>REV</code></summary>\n\nWhen present, returns elements in reverse chronological order (most recent first) instead of the default oldest-first order.\n\n</details>"
    },
    {
      "id": "examples",
      "title": "Examples",
      "role": "example",
      "text": "redis> ARINSERT log \"first\"\n(integer) 0\nredis> ARINSERT log \"second\"\n(integer) 1\nredis> ARINSERT log \"third\"\n(integer) 2\nredis> ARLASTITEMS log 2\n1) \"second\"\n2) \"third\"\nredis> ARLASTITEMS log 2 REV\n1) \"third\"\n2) \"second\""
    },
    {
      "id": "redis-software-and-redis-cloud-compatibility",
      "title": "Redis Software and Redis Cloud compatibility",
      "role": "content",
      "text": "| Redis<br />Software | Redis<br />Cloud | <span style=\"min-width: 9em; display: table-cell\">Notes</span> |\n|:----------------------|:-----------------|:------|\n| <span title=\"Not supported\">&#x274c; Standard</span><br /><span title=\"Not supported\"><nobr>&#x274c; Active-Active</nobr></span> | <span title=\"Not supported\">&#x274c; Standard</span><br /><span title=\"Not supported\"><nobr>&#x274c; Active-Active</nobr></span> |  |"
    },
    {
      "id": "return-information",
      "title": "Return information",
      "role": "returns",
      "text": "**RESP2:**\n\n[Array reply](../../develop/reference/protocol-spec#arrays)\n\n**RESP3:**\n\n[Array reply](../../develop/reference/protocol-spec#arrays)"
    }
  ],
  "examples": []
}
