clearHttpCache 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':
                

    }

    /** * 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} */

        } else {
            $shops = $shopRepository->getActiveShopsFixed();
        }

        $io = new SymfonyStyle($input$output);
        $options = $this->prepareOptions($input->getOptions()$urlProviderFactory);

        // Clear cache?         if ($input->getOption('clear-cache')) {
            $io->writeln('Clearing httpcache.');
            $this->container->get(CacheManager::class)->clearHttpCache();
        }

        /* * Print information about concurrent requests * Help message for this command may be confusing about using an equal sign. So better strip it. */
        $concurrentRequests = (int) trim($input->getOption('concurrent-requests'), '=');
        $limit = $concurrentRequests > 10 ? $concurrentRequests : 10;
        $io->writeln(sprintf('Calling URLs with %d concurrent requests', $concurrentRequests));

        // Print warming information
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;
            case self::CACHE_TAG_PROXY:
                $this->clearProxyCache();
                $this->clearOpCache();
                break;
            default:
                return false;
        }

        return true;
    }

    
$timestamp = $this->container->get('theme_timestamp_persistor')->getCurrentTimestamp($shop->getId());
            $output->writeln(sprintf('Generating theme cache for shop "%s" from current timestamp %s', $shop->getName()$timestamp));
            $compiler->recompile($shop);
        }

        if ($current) {
            return 0;
        }

        $cacheManager = $this->container->get(CacheManager::class);
        $output->writeln('Clearing HTTP cache ...');
        $cacheManager->clearHttpCache();

        return 0;
    }
}
Home | Imprint | This part of the site doesn't use cookies.