function ResponseHeaderBag::computeCacheControlValue
Returns the calculated value of the cache-control header.
This considers several other headers and calculates or modifies the cache-control header to a sensible, conservative value.
1 call to ResponseHeaderBag::computeCacheControlValue()
- ResponseHeaderBag::set in vendor/
symfony/ http-foundation/ ResponseHeaderBag.php - Sets a header by name.
File
-
vendor/
symfony/ http-foundation/ ResponseHeaderBag.php, line 243
Class
- ResponseHeaderBag
- ResponseHeaderBag is a container for Response HTTP headers.
Namespace
Symfony\Component\HttpFoundationCode
protected function computeCacheControlValue() : string {
if (!$this->cacheControl) {
if ($this->has('Last-Modified') || $this->has('Expires')) {
return 'private, must-revalidate';
// allows for heuristic expiration (RFC 7234 Section 4.2.2) in the case of "Last-Modified"
}
// conservative by default
return 'no-cache, private';
}
$header = $this->getCacheControlHeader();
if (isset($this->cacheControl['public']) || isset($this->cacheControl['private'])) {
return $header;
}
// public if s-maxage is defined, private otherwise
if (!isset($this->cacheControl['s-maxage'])) {
return $header . ', private';
}
return $header;
}