示例#1
0
 /**
  * Increment a number under the key and return incremented value
  *
  * @param string $key Identifier for the data
  * @param int $offset How much to add
  * @return bool|int New incremented value, false otherwise
  */
 public function increment($key, $offset = 1)
 {
     $key = $this->_key($key);
     if (!$this->client->exists($key)) {
         return false;
     }
     return $this->client->incrby($key, $offset);
 }
示例#2
0
 /**
  * {@inheritDoc}
  */
 public function incrby($key, $increment)
 {
     return $this->predis->incrby($key, $increment);
 }
示例#3
0
文件: PredisTest.php 项目: gmo/cache
 /**
  * @group redis-strings
  */
 public function testIncrementBy()
 {
     $this->assertEquals(2, $this->client->incrby('foo', 2));
     $this->assertEquals(4, $this->client->incrby('foo', 2));
 }