Jelajahi Sumber

Fix and optimize WATCH with CAS.

Daniele Alessandri 14 tahun lalu
induk
melakukan
d667bcb6bb
1 mengubah file dengan 3 tambahan dan 14 penghapusan
  1. 3 14
      lib/Predis.php

+ 3 - 14
lib/Predis.php

@@ -890,21 +890,10 @@ class MultiExecBlock {
 
     public function watch($keys) {
         $this->isWatchSupported();
-        if ($this->_initialized === true) {
-            throw new \Predis\ClientException('WATCH inside MULTI is not allowed');
+        if ($this->_initialized && !$this->_checkAndSet) {
+            throw new ClientException('WATCH inside MULTI is not allowed');
         }
-
-        $reply = null;
-        if (is_array($keys)) {
-            $reply = array();
-            foreach ($keys as $key) {
-                $reply = $this->_redisClient->watch($keys);
-            }
-        }
-        else {
-            $reply = $this->_redisClient->watch($keys);
-        }
-        return $reply;
+        return $this->_redisClient->watch($keys);
     }
 
     public function multi() {