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.
string
protected function computeCacheControlValue() {
if (!$this->cacheControl && !$this
->has('ETag') && !$this
->has('Last-Modified') && !$this
->has('Expires')) {
return 'no-cache';
}
if (!$this->cacheControl) {
// conservative by default
return 'private, must-revalidate';
}
$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;
}