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
);
$this->request->
setParam('__cache',
$cacheTime);
$this->response->headers->
set('cache-control', 'public, max-age=' .
$cacheTime . ', s-maxage=' .
$cacheTime, true
);
$noCacheTags =
$cacheControl->
getNoCacheTagsForRequest($this->request,
$shopId);