示例#1
0
 public function testDiscard()
 {
     $response = $this->transaction->set('a', 1)->get('a')->delete('a')->set('b', 2)->discard();
     $this->assertEquals($this->rediska->get('b'), null);
 }
示例#2
0
 /**
  * Adds the commands needed for the count function
  *
  * @param Rediska_Transaction $transaction
  * @param string $subject A unique identifier, for example a session id or an IP
  * @param int $bucket
  * @param int $count
  * @return void
  */
 protected function _setMulitExecGetCountPart(Rediska_Transaction $transaction, $subject, $bucket, $count)
 {
     $keyName = $this->_getKeyName($subject);
     // Get the counts from the previous `$count` buckets
     $transaction->getfromhash($keyName, $bucket);
     for ($i = $count; $i > 0; $i--) {
         $transaction->getfromhash($keyName, (--$bucket + $this->_bucketCount) % $this->_bucketCount);
     }
     return $transaction;
 }