Esempio n. 1
0
 public function __call($name, $args)
 {
     if (strtolower($name) == 'pipeline') {
         return $this->_rediska->pipeline();
     } else {
         $command = $this->_rediska->getCommand($name, $args);
         $command->write();
         return $command->read();
     }
 }
Esempio n. 2
0
 public function __call($name, $args)
 {
     if (strtolower($name) == 'on' && isset($args[0])) {
         $this->_rediska->on($args[0]);
         $this->_oneTimeConnection = $this->_specifiedConnection->getConnection();
         return $this;
     }
     if ($this->_oneTimeConnection) {
         $connection = $this->_oneTimeConnection;
         $this->_oneTimeConnection = null;
     } else {
         $connection = $this->_defaultConnection;
     }
     if ($connection !== null) {
         $this->_specifiedConnection->setConnection($connection);
     } else {
         $this->_specifiedConnection->resetConnection();
     }
     $command = $this->_rediska->getCommand($name, $args);
     if (!$command->isAtomic()) {
         throw new Rediska_Exception("Command '{$name}' doesn't work properly (not atomic) in pipeline on multiple servers");
     }
     $this->_commands[] = $command;
     $this->_specifiedConnection->resetConnection();
     return $this;
 }