Selaa lähdekoodia

Move check for WATCH and UNWATCH support.

Daniele Alessandri 11 vuotta sitten
vanhempi
commit
1e0ef2a64d
1 muutettua tiedostoa jossa 2 lisäystä ja 5 poistoa
  1. 2 5
      lib/Predis/Transaction/MultiExec.php

+ 2 - 5
lib/Predis/Transaction/MultiExec.php

@@ -35,7 +35,6 @@ class MultiExec implements BasicClientInterface, ExecutableContextInterface
 
     protected $client;
     protected $commands;
-    protected $canwatch   = false;
     protected $exceptions = true;
     protected $attempts   = 0;
     protected $watchKeys  = array();
@@ -102,8 +101,6 @@ class MultiExec implements BasicClientInterface, ExecutableContextInterface
         if (isset($options['retry'])) {
             $this->attempts = (int) $options['retry'];
         }
-
-        $this->canwatch = $client->getProfile()->supportsCommands(array('watch', 'unwatch'));
     }
 
     /**
@@ -213,7 +210,7 @@ class MultiExec implements BasicClientInterface, ExecutableContextInterface
      */
     public function watch($keys)
     {
-        if (!$this->canwatch) {
+        if (!$this->client->getProfile()->supportsCommand('WATCH')) {
             throw new NotSupportedException('WATCH is not supported by the current profile');
         }
 
@@ -252,7 +249,7 @@ class MultiExec implements BasicClientInterface, ExecutableContextInterface
      */
     public function unwatch()
     {
-        if (!$this->canwatch) {
+        if (!$this->client->getProfile()->supportsCommand('WATCH')) {
             throw new NotSupportedException('UNWATCH is not supported by the current profile');
         }