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