Back to Redis

TOUCH

content/commands/touch.md

latest1.1 KB
Original Source

{{< note >}} This command's behavior varies in clustered Redis environments. See the [multi-key operations]({{< relref "/develop/using-commands/multi-key-operations" >}}) page for more information. {{< /note >}}

Alters the last access time of a key(s). A key is ignored if it does not exist.

Examples

{{% redis-cli %}} SET key1 "Hello" SET key2 "World" TOUCH key1 key2 {{% /redis-cli %}}

Redis Software and Redis Cloud compatibility

| Redis Software | Redis Cloud | <span style="min-width: 9em; display: table-cell">Notes</span> | |:----------------------|:-----------------|:------| | <span title="Supported">✅ Standard</span> <span title="Supported"><nobr>✅ Active-Active</nobr></span> | <span title="Supported">✅ Standard</span> <span title="Supported"><nobr>✅ Active-Active</nobr></span> | |

Return information

{{< multitabs id="touch-return-info" tab1="RESP2" tab2="RESP3" >}}

Integer reply: the number of touched keys.

-tab-sep-

Integer reply: the number of touched keys.

{{< /multitabs >}}