public function HttpCache::__construct in Zircon Profile 8.0
Same name and namespace in other branches
- 8 vendor/symfony/http-kernel/HttpCache/HttpCache.php \Symfony\Component\HttpKernel\HttpCache\HttpCache::__construct()
Constructor.
The available options are:
- debug: If true, the traces are added as a HTTP header to ease debugging
- default_ttl The number of seconds that a cache entry should be considered fresh when no explicit freshness information is provided in a response. Explicit Cache-Control or Expires headers override this value. (default: 0)
- private_headers Set of request headers that trigger "private" cache-control behavior on responses that don't explicitly state whether the response is public or private via a Cache-Control directive. (default: Authorization and Cookie)
- allow_reload Specifies whether the client can force a cache reload by including a Cache-Control "no-cache" directive in the request. Set it to ``true`` for compliance with RFC 2616. (default: false)
- allow_revalidate Specifies whether the client can force a cache revalidate by including a Cache-Control "max-age=0" directive in the request. Set it to ``true`` for compliance with RFC 2616. (default: false)
- stale_while_revalidate Specifies the default number of seconds (the granularity is the second as the Response TTL precision is a second) during which the cache can immediately return a stale response while it revalidates it in the background (default: 2). This setting is overridden by the stale-while-revalidate HTTP Cache-Control extension (see RFC 5861).
- stale_if_error Specifies the default number of seconds (the granularity is the second) during which the cache can serve a stale response when an error is encountered (default: 60). This setting is overridden by the stale-if-error HTTP Cache-Control extension (see RFC 5861).
Parameters
HttpKernelInterface $kernel An HttpKernelInterface instance:
StoreInterface $store A Store instance:
SurrogateInterface $surrogate A SurrogateInterface instance:
array $options An array of options:
File
- vendor/
symfony/ http-kernel/ HttpCache/ HttpCache.php, line 78
Class
- HttpCache
- Cache provides HTTP caching.
Namespace
Symfony\Component\HttpKernel\HttpCacheCode
public function __construct(HttpKernelInterface $kernel, StoreInterface $store, SurrogateInterface $surrogate = null, array $options = array()) {
$this->store = $store;
$this->kernel = $kernel;
$this->surrogate = $surrogate;
// needed in case there is a fatal error because the backend is too slow to respond
register_shutdown_function(array(
$this->store,
'cleanup',
));
$this->options = array_merge(array(
'debug' => false,
'default_ttl' => 0,
'private_headers' => array(
'Authorization',
'Cookie',
),
'allow_reload' => false,
'allow_revalidate' => false,
'stale_while_revalidate' => 2,
'stale_if_error' => 60,
), $options);
}