/** * {@inheritdoc} */ public function increment($key, $value = 1) { if ($value < 1) { throw new \InvalidArgumentException('Value of incrementation must be greater that nil.'); } if ($value === 1) { return $this->redis->incr($key); } return $this->redis->incrBy($key, $value); }
/** * {@inheritdoc} */ public function clear($key = null) { if (is_null($key)) { $this->redis->flushDB(); return true; } $keyString = $this->makeKeyString($key, true); $keyReal = $this->makeKeyString($key); $this->redis->incr($keyString); // increment index for children items $this->redis->delete($keyReal); // remove direct item. $this->keyCache = array(); return true; }