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; }
/** * Magic method for add command to pipeline * * @param string $name Command name * @param array $args Arguments * @return Rediska_Pipeline */ public function __call($name, $args) { if (strtolower($name) == 'on' && isset($args[0])) { $this->_rediska->on($args[0]); $this->_oneTimeConnection = $this->_specifiedConnection->getConnection(); return $this; } // TODO: Implement transaction and config if (in_array(strtolower($name), array('transaction', 'config'))) { throw new Rediska_Exception("{$name} in pipeline not implemented yet."); } if (in_array(strtolower($name), array('monitor', 'subscribe'))) { throw new Rediska_Transaction_Exception("You can't use '{$name}' in pipeline"); } return $this->_addCommand($name, $args); }