Skip to main content
Use TOUCH to update the last access time of one or more keys without reading their values. The reply counts how many of the given keys exist, just like EXISTS, but the call also refreshes the idle time and access frequency that the LRU and LFU eviction policies rely on. That makes it a way to tell the server that a key is still in use, for example to keep a cached value from being evicted while a slower process is still going to need it. It does not change the key’s expiration.

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.