Performance Tuning / Request Caching / Symfony Reverse Proxy
Note: You are currently reading the documentation for Bolt 3.2. Looking for the documentation for Bolt 3.6 instead?
Bolt comes with Symfony's HTTP Cache component, that you can use to configure Symfony's Reverse Proxy that can act as a very simple reverse proxy, to cache rendered pages on disk for a period of time.
Note: Requests for logged on users will not be cached.
To enable Symfony' Reverse Proxy for your Bolt install, in
config.yml file, find the
caching: key, and enabling the
caching: request: true
There are several options that get passed to the cache, this can be set under
performance: key in your
performance: http_cache: options: default_ttl: 8 private_headers: [ Authorization, Cookie ] allow_reload: false allow_revalidate: false stale_while_revalidate: 2 stale_if_error: 60
||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)|
||Set of request headers that trigger "private" cache-control behaviour on responses that don't explicitly state whether the response is public or private via a Cache-Control directive. (default: Authorization and Cookie)|
||If the client can force a cache reload by including a Cache-Control "no-cache" directive in the request. Set it to
||If the client can force a cache re-validate by including a Cache-Control "max-age=0" directive in the request. Set it to
||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 re-validates it in the background (default: 2). This setting is overridden by 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).|
For more information on these options, see the Symfony documentation page for the HTTP Cache component, and how to extend it further.