コード例 #1
0
 /**
  * We manually remove keys as the redis glob style * == sfCache ** style
  *
  * @see sfCache
  */
 public function removePattern($pattern)
 {
     $pattern = $this->getKey($pattern);
     $regexp = self::patternToRegexp($pattern);
     foreach ($this->redis->keys($pattern) as $key) {
         if (preg_match($regexp, $key)) {
             $this->remove(substr($key, strlen($this->getOption('prefix'))));
         }
     }
 }
コード例 #2
0
 /**
  * Return an array of stored cache ids
  *
  * @return array array of stored cache ids (string)
  */
 public function getIds()
 {
     if ($this->_notMatchingTags) {
         return (array) $this->_redis->sMembers(self::SET_IDS);
     } else {
         $keys = $this->_redis->keys(self::PREFIX_KEY . '*');
         $prefixLen = strlen(self::PREFIX_KEY);
         foreach ($keys as $index => $key) {
             $keys[$index] = substr($key, $prefixLen);
         }
         return $keys;
     }
 }