isCacheableRoute example

/** * Sets the Shopware cache headers * * @return bool */
    public function setCacheHeaders()
    {
        /** @var CacheControl $cacheControl */
        $cacheControl = $this->get('http_cache.cache_control');

        $shopId = $this->get('shop')->getId();
        if (!$cacheControl->isCacheableRoute($this->request)) {
            return false;
        }

        if ($cacheControl->useNoCacheControl($this->request, $this->response, $shopId)) {
            $this->response->headers->set('cache-control', 'private, no-cache', true);

            return false;
        }

        $cacheTime = (int) $cacheControl->getCacheTime($this->request);

        
Home | Imprint | This part of the site doesn't use cookies.