WATCH
Registers a key for optimistic transaction conflict detection.
Transactions · Example verified
Syntax covered here
WATCH keyThe case modifies the watched key from another connection before EXEC, which then aborts the queued transaction.
Tested example & replies
Requests below run in order against an empty database. Each connection authenticates with the fixture password first. Quoted values are strings; null is a nil reply; arrays preserve RESP order.
# connection: default
> WATCH sample
"OK"
# connection: other
> SET sample other
"OK"
# connection: default
> MULTI
"OK"
# connection: default
> GET sample
"QUEUED"
# connection: default
> EXEC
null