Exemplo n.º 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);
 }
Exemplo n.º 2
0
 /**
  * {@inheritDoc}
  */
 public function incrby($key, $increment)
 {
     return $this->predis->incrby($key, $increment);
 }
Exemplo n.º 3
0
 /**
  * @group redis-strings
  */
 public function testIncrementBy()
 {
     $this->assertEquals(2, $this->client->incrby('foo', 2));
     $this->assertEquals(4, $this->client->incrby('foo', 2));
 }