Esempio n. 1
0
 /**
  * Execute pipelined commands
  * 
  * @return array
  */
 public function execute()
 {
     $results = array();
     if (!empty($this->_commands)) {
         $this->_rediska->getProfiler()->start($this);
         foreach ($this->_commands as $command) {
             $command->write();
         }
         foreach ($this->_commands as $command) {
             $results[] = $command->read();
         }
         $this->_rediska->getProfiler()->stop();
     }
     return $results;
 }
Esempio n. 2
0
 /**
  * Execute transaction
  * 
  * @return array
  */
 public function execute()
 {
     $results = array();
     $this->_rediska->getProfiler()->start($this);
     $multi = new Rediska_Connection_Exec($this->_connection, 'MULTI');
     $multi->execute();
     foreach ($this->_commands as $command) {
         $command->execute();
     }
     $exec = new Rediska_Connection_Exec($this->_connection, 'EXEC');
     $responses = $exec->execute();
     $this->_rediska->getProfiler()->stop();
     if (!$responses) {
         throw new Rediska_Transaction_AbortedException('Transaction has been aborted by server');
     }
     foreach ($this->_commands as $i => $command) {
         $results[] = $command->parseResponses(array($responses[$i]));
     }
     $this->_reset();
     return $results;
 }