Beispiel #1
0
 /**
  * Decrement a number under the key and return decremented value
  *
  * @param string $key Identifier for the data
  * @param int $offset How much to subtract
  * @return bool|int New incremented value, false otherwise
  */
 public function decrement($key, $offset = 1)
 {
     $key = $this->_key($key);
     if (!$this->client->exists($key)) {
         return false;
     }
     return $this->client->decrby($key, $offset);
 }
Beispiel #2
0
 /**
  * {@inheritDoc}
  */
 public function decrby($key, $decrement)
 {
     return $this->predis->decrby($key, $decrement);
 }
Beispiel #3
0
 /**
  * @group redis-strings
  */
 public function testDecrementBy()
 {
     $this->assertEquals(-2, $this->client->decrby('foo', 2));
     $this->assertEquals(-4, $this->client->decrby('foo', 2));
 }