/** * 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); }
/** * {@inheritDoc} */ public function decrby($key, $decrement) { return $this->predis->decrby($key, $decrement); }
/** * @group redis-strings */ public function testDecrementBy() { $this->assertEquals(-2, $this->client->decrby('foo', 2)); $this->assertEquals(-4, $this->client->decrby('foo', 2)); }