Example #1
0
 /**
  * Add accumulative metric.
  *
  * @param EntryInterface $entry    Entry
  * @param string         $entryKey Key entry
  *
  * @return $this Self Object
  */
 private function addAccumulativeEntry(EntryInterface $entry, $entryKey)
 {
     $this->doRedisQuery(function () use($entry, $entryKey) {
         $this->redis->incrby($entryKey . '_accum', (int) $entry->getValue());
     });
     return $this;
 }
Example #2
0
 /**
  * Increase the cache item.
  *
  * @see http://redis.io/commands/incr
  * @see http://redis.io/commands/incrby
  *
  * @param string $key The cache key
  * @param int $increment Increment value
  *
  * @return mixed
  */
 public function increase($key, $increment = 1)
 {
     $increment = abs((int) $increment);
     if ($increment <= 1) {
         $this->client->incr($key);
     } else {
         $this->client->incrby($key, $increment);
     }
     return $this;
 }
Example #3
0
 /**
  * {@inheritdoc}
  *
  * @return \Orno\Cache\Adapter\RedisAdapter
  */
 public function increment($key, $offset = 1)
 {
     $this->redis->incrby($key, $offset);
     return $this;
 }
 /**
  * Increments an item in the cache.
  *
  * @param string $key
  * @param int $amount
  *
  * @return mixed
  */
 public function increment(string $key, int $amount = 1)
 {
     $this->predis->incrby($this->prefix . $key, $amount);
 }
Example #5
0
 public function incrementKey($key, $increment)
 {
     return $this->_client->incrby($key, $increment);
 }