multi() public method

Finalizes the transaction by executing MULTI on the server.
public multi ( ) : MultiExec
return MultiExec
コード例 #1
0
ファイル: RedisQueue.php プロジェクト: rodrigopbel/ong
 /**
  * Remove the expired jobs from a given queue.
  *
  * @param  \Predis\Transaction\MultiExec  $transaction
  * @param  string  $from
  * @param  int  $time
  * @return void
  */
 protected function removeExpiredJobs($transaction, $from, $time)
 {
     $transaction->multi();
     $transaction->zremrangebyscore($from, '-inf', $time);
 }
コード例 #2
0
 /**
  * @group disconnected
  * @expectedException \Predis\Response\ServerException
  * @expectedExceptionMessage ERR simulated failure on EXEC
  */
 public function testExceptionsOptionDoesNotAffectTransactionControlCommands()
 {
     $connection = $this->getMockedConnection(function (CommandInterface $command) {
         switch ($command->getId()) {
             case 'MULTI':
                 return true;
             case 'EXEC':
                 return new Response\Error('ERR simulated failure on EXEC');
             default:
                 return new Response\Status('QUEUED');
         }
     });
     $client = new Client($connection, array('exceptions' => false));
     $tx = new MultiExec($client);
     $tx->multi()->echo('test')->exec();
 }