Explorar o código

Fix and optimize WATCH with CAS.

Daniele Alessandri %!s(int64=14) %!d(string=hai) anos
pai
achega
46b56437a4
Modificáronse 1 ficheiros con 2 adicións e 13 borrados
  1. 2 13
      lib/Predis.php

+ 2 - 13
lib/Predis.php

@@ -850,21 +850,10 @@ class MultiExecBlock {
 
     public function watch($keys) {
         $this->isWatchSupported();
-        if ($this->_initialized === true) {
+        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() {