w3resource

Redis Transactions: WATCH key [key ...]

Description

Redis WATCH command is used to mark the given keys to be watched for conditional execution of a transaction.

Syntax:

WATCH key [key ...] 

Available since

2.2.0.

Return Value

Simple string reply: always OK.

Return Value Type

String

Example:

127.0.0.1:6379> WATCH zset
OK
127.0.0.1:6379> MULTI
OK
127.0.0.1:6379> ZREM zset element
QUEUED
127.0.0.1:6379> EXEC
1) (integer) 0

Previous: UNWATCH
Next: Redis Scripting EVAL



Follow us on Facebook and Twitter for latest update.