/**
  * {@inheritDoc}
  */
 public function has($identifier, $type = null, $unique = null)
 {
     if (!is_null($type) && !is_null($unique)) {
         $identifier = base64_encode(implode(':', [$identifier, $type, $unique]));
     }
     return $this->redis->hexists('aggregator:objects', $identifier);
 }
Example #2
0
 public function limitRate($key)
 {
     if (!$this->client->hexists($key, 'limit')) {
         return false;
     }
     $this->client->hincrby($key, 'calls', 1);
     return $this->getRateInfo($key);
 }
Example #3
0
 /**
  * @param string $name
  * @return bool
  */
 public function has($name)
 {
     if (ArrayUtils::hasInArray($this->conf, $name)) {
         return true;
     } else {
         if ($this->redis) {
             $f = $this->getField($name);
             $b = $this->redis->hexists($this->key, $f);
             if ($b) {
                 $v = $this->redis->hget($this->key, $f);
                 $this->conf[$f] = unserialize($v);
                 return ArrayUtils::hasInArray($this->conf, $name);
             }
         }
     }
     return false;
 }
Example #4
0
 /**
  * @param $key
  * @param $field
  * @return bool
  */
 public function existsInHTable($key, $field)
 {
     return 1 === $this->redis->hexists($key, $field);
 }