Upstash Documentation

UNWATCH

Unwatch all keys.
2 min read

Use UNWATCH to forget all the keys watched with WATCH on this connection.

Afterwards the next EXEC is no longer conditional on those keys. It is the way to abandon an optimistic locking attempt when, after reading the watched data, you decide not to run a transaction at all, so a later unrelated transaction is not aborted by a change to keys you no longer care about. EXEC and DISCARD clear watches on their own.

The raw command is TCP-only. Over HTTP, use the transaction or pipeline API of an Upstash SDK instead of sending this command directly.

Syntax#

Arguments#

This command takes no arguments.

Important points#

  • The raw command is TCP-only. For HTTP, use an Upstash SDK transaction API rather than sending this command directly.

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.

ProtocolReply
RESP2Simple string OK
RESP3Simple string OK
Note

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.

Redis CLI
ioredis
node-redis
redis-py
go-redis
jedis
redis-rs