clearSearchCache example

protected function clearCache($cache)
    {
        $capabilities = $this->cache->getBackend()->getCapabilities();

        if ($cache === 'all') {
            $this->cache->clean();

            $this->cacheManager->clearHttpCache();
            $this->cacheManager->clearConfigCache();
            $this->cacheManager->clearTemplateCache();
            $this->cacheManager->clearProxyCache();
            $this->cacheManager->clearSearchCache();
            $this->cacheManager->clearOpCache();

            return;
        }

        switch ($cache) {
            case 'http':
                $this->cacheManager->clearHttpCache();
                break;
            case 'config':
                $tags[] = CacheManager::ITEM_TAG_CONFIG;
                
/** * Clear cache action */
    public function clearDirectAction()
    {
        $cache = $this->Request()->getQuery('cache');
        switch ($cache) {
            case 'Config':
                $this->cacheManager->clearHttpCache();
                $this->cacheManager->clearTemplateCache();
                $this->cacheManager->clearConfigCache();
                $this->cacheManager->clearSearchCache();
                $this->cacheManager->clearProxyCache();
                break;
            default:
                break;
        }
    }

    /** * {@inheritdoc} */
    protected function initAcl()
    {

    public function clearByTag($tag)
    {
        switch ($tag) {
            case self::CACHE_TAG_CONFIG:
                $this->clearConfigCache();
                break;
            case self::CACHE_TAG_SEARCH:
                $this->clearSearchCache();
                break;
            case self::CACHE_TAG_ROUTER:
                $this->clearRewriteCache();
                break;
            case self::CACHE_TAG_TEMPLATE:
                $this->clearTemplateCache();
                break;
            case self::CACHE_TAG_THEME:
            case self::CACHE_TAG_HTTP:
                $this->clearHttpCache();
                break;
            
Home | Imprint | This part of the site doesn't use cookies.