You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.markdown
+17Lines changed: 17 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -167,6 +167,23 @@ $ret == array(
167
167
*/
168
168
</pre>
169
169
170
+
## watch, unwatch
171
+
##### Description
172
+
Watches a key for modifications by another client. If the key is modified between `WATCH` and `EXEC`, the MULTI/EXEC transaction will fail (return `FALSE`). `unwatch` cancels all the watching of all keys by this client.
173
+
##### Parameters
174
+
*keys*: a list of keys
175
+
##### Example
176
+
<pre>
177
+
$redis->watch('x');
178
+
/* long code here during the execution of which other clients could well modify `x` */
179
+
$ret = $redis->multi()
180
+
->incr('x')
181
+
->exec();
182
+
/*
183
+
$ret = FALSE if x has been modified between the call to WATCH and the call to EXEC.
0 commit comments