Clears the cache.

@param string  $key         Cache key name or pattern
@param boolean $prefix_mode Enable it to clear all keys starting
with prefix specified in $key
486312
function remove($key=null, $prefix_mode=false)
    {
        // Remove all keys
        if ($key === null) {
            $this->cache         = array();
            $this->cache_changes = array();
            $this->cache_sums    = array();
        }
        // Remove keys by name prefix
        else if ($prefix_mode) {
            foreach (array_keys($this->cache) as $k) {
                if (strpos($k, $key) === 0) {
                    $this->cache[$k] = null;
                    $this->cache_changes[$k] = false;
                    unset($this->cache_sums[$k]);
                }
            }
        }
        // Remove one key by name
        else {
            $this->cache[$key] = null;
            $this->cache_changes[$key] = false;
            unset($this->cache_sums[$key]);
        }

        // Remove record(s) from the backend
        $this->remove_record($key, $prefix_mode);
    }
760926
private function remove_record($key=null, $prefix_mode=false)
    {
        if (!$this->db) {
            return;
        }

        if ($this->type != 'db') {
            $this->load_index();

            // Remove all keys
            if ($key === null) {
                foreach ($this->index as $key) {
                    $this->delete_record($this->ckey($key));
                }

                $this->index = array();
            }
            // Remove keys by name prefix
            else if ($prefix_mode) {
                foreach ($this->index as $idx => $k) {
                    if (strpos($k, $key) === 0) {
                        $this->delete_record($this->ckey($k));
                        unset($this->index[$idx]);
                    }
                }
            }
            // Remove one key by name
            else {
                $this->delete_record($this->ckey($key));
                if (($idx = array_search($key, $this->index)) !== false) {
                    unset($this->index[$idx]);
                }
            }

            $this->index_changed = true;

            return;
        }

        // Remove all keys (in specified cache)
        if ($key === null) {
            $where = " AND `cache_key` LIKE " . $this->db->quote($this->prefix.'.%');
        }
        // Remove keys by name prefix
        else if ($prefix_mode) {
            $where = " AND `cache_key` LIKE " . $this->db->quote($this->prefix.'.'.$key.'%');
        }
        // Remove one key by name
        else {
            $where = " AND `cache_key` = " . $this->db->quote($this->prefix.'.'.$key);
        }

        $this->db->query(
            "DELETE FROM {$this->table} WHERE `user_id` = ?" . $where,
            $this->userid);
    }
328665
public function remove($key)
    {
        if ($this->has($key)) {
            unset($this->cache[$key]);
            return true;
        } else {
            return false;
        }
    }
625021
public function purge($key)
    {
        $cacheFile = $this->getCachePath($key);

        clearstatcache(true, $cacheFile);
        if (file_exists($cacheFile)) {
            unset($cacheFile);

            return true;
        }

        return false;
    }
590121
public function get_file_cache($key,$prefix=''){
        $option = array(
            'type'=>'File',
            'prefix'=>$prefix,
            'path'=>CACHE_PATH,
        );
        $cache = \think\Cache::connect($option);
        return $cache->get($key,[]);
    }
1310907
public function cacheReset($key = null) {
        if (is_null($key)) {
            $this->_cache = array();
        } else {
            unset($this->_cache[$key]);
        }
    }
913826
public function clear(CacheKey $key) {
		if (isset ( $this->elements [$key->getModule()] [$key->getProperty()] )) {
			unset ( $this->elements [$key->getModule()] [$key->getProperty()] );
			$this->changed = true;
		}
	}
560609
public function clear($key = null)
    {
        if (isset($key)) {
            if (isset($this->data[$key])) {
                unset($this->data[$key]);
            }
        } else {
            $this->data = [];
        }
    }
263900
public function remove($key)
    {
        if (!$this->isEnabled()) {
            return false;
        }

        return $this->server->delete($this->prefix . $key);
    }
1247172
public function forget($key)
        {
            $this->_cleanCache();
            $res = Data::query('cache', 'key = ' . $key . ' && namespace = ' . $this->namespace);
            if (count($res)) {
                $obj = Data::getObject(current($res));
                $del = Data::delete('cache', $obj->getId());
            }
        }
722425
public function delete(string $key): bool
    {
        Redis::delete(self::PREFIX . $key);
        return parent::delete($key);
    }
269811
public function remove($key)
    {
        $key = str_replace('_', '-', strtolower($key));

        unset($this->headers[$key]);

        if ('cache-control' === $key) {
            $this->cacheControl = array();
        }
    }
1060716
public function forget(string $key): bool
    {
        $key = $this->hashKey($key);
        if (\array_key_exists($key, $this->cache)) {
            unset($this->cache[$key]);
            return true;
        }
        return false;
    }
1066297
public function clear($key)
    {
        if (isset($_SESSION[$this->prefix . $key])) {
            unset($_SESSION[$this->prefix . $key]);
        }
    }
575887
public function delete($key)
    {
        $cache_file = $this->path($key);
        if (file_exists($cache_file)) {
            $unlink_result = unlink($cache_file);
            if ($unlink_result === false) return false;
        }

        return true;
    }
662401
protected function hasMutatorMethod($key, $prefix)
    {
        $method = $this->buildMutatorMethod($key, $prefix);

        return method_exists($this, $method);
    }
475452
public function ClearCache(string $keyPattern = NULL)
    {
        if (GnApi::$Debug) {
            GnLogger::Verbose("Clear cache '{$keyPattern}'");
        }

        if (static::$CacheHandler) {
            static::$CacheHandler->deleteKey($keyPattern);
            static::$CacheHandler->deleteGroup($keyPattern);
        } else {
            $keys = $this->_memcached->getAllKeys();
            if (GnUtil::IsNullOrEmpty($keyPattern)) {
                // remove all items
                foreach ($keys as $key) {
                    $this->_memcached->delete($key);
                }
                return;
            }

            // remove key-patterns only
            foreach ($keys as $key) {
                $matches = array();
                $ret = preg_match("/" . preg_quote($keyPattern, '/') . "/", $key, $matches);
                if ($ret > 0) {
                    $this->_memcached->delete($key);
                }
            }
        }
    }