{
  "schema_version": 2,
  "id": "commands/touch",
  "title": "TOUCH",
  "url": "https://redis.io/docs/latest/commands/touch/",
  "summary": "Returns the number of existing keys out of those specified after updating the time they were last accessed.",
  "since": "3.2.1",
  "tags": [
    "docs",
    "develop",
    "stack",
    "oss",
    "rs",
    "rc",
    "oss",
    "kubernetes",
    "clients"
  ],
  "last_updated": "2026-09-18T09:48:32+01:00",
  "page_type": "content",
  "content_hash": "81412a126c9ca264c4bd960db84f9c5a21e0da1fd1f14b7b44ed41b6766034c8",
  "sections": [
    {
      "id": "overview",
      "title": "Overview",
      "role": "overview",
      "text": "> [!NOTE]\n> This command's behavior varies in clustered Redis environments. See the [multi-key operations](https://redis.io/docs/latest/develop/using-commands/multi-key-operations) page for more information.\n\n\nAlters the last access time of one or more keys.\nA key is ignored if it does not exist."
    },
    {
      "id": "required-arguments",
      "title": "Required arguments",
      "role": "content",
      "text": "<details open><summary><code>key [key ...]</code></summary>\n\nOne or more keys whose last-access time to update.\n\n</details>"
    },
    {
      "id": "examples",
      "title": "Examples",
      "role": "example",
      "text": "redis> SET key1 \"Hello\"\nOK\nredis> SET key2 \"World\"\nOK\nredis> TOUCH key1 key2\n(integer) 2"
    },
    {
      "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=\"Supported\">&#x2705; Standard</span><br /><span title=\"Supported\"><nobr>&#x2705; Active-Active</nobr></span> | <span title=\"Supported\">&#x2705; Standard</span><br /><span title=\"Supported\"><nobr>&#x2705; Active-Active</nobr></span> |  |"
    },
    {
      "id": "return-information",
      "title": "Return information",
      "role": "returns",
      "text": "**RESP2:**\n\n[Integer reply](../../develop/reference/protocol-spec#integers): the number of touched keys.\n\n**RESP3:**\n\n[Integer reply](../../develop/reference/protocol-spec#integers): the number of touched keys."
    }
  ],
  "examples": []
}
