/**
  * 清楚redis中的所有缓存
  */
 public function flush()
 {
     if ($this->_prefix) {
         $keys = $this->_client->keys($this->_prefix);
     } else {
         $keys = $this->_client->keys("*");
     }
     foreach ((array) $keys as $k) {
         $this->_client->del($k);
     }
 }
Exemplo n.º 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;
     }
 }