Provides HTTP cache handling for eZ Platform, by default since version 1.12. From ezpublish-kernel, it adds support for mult-tagging for Symfony Proxy, Varnish (using xkey). Support for Fastly is part of the eZ Platform Cloud Enterprise offer as of 1.13 LTS.
- Add the package to
app/AppKernel.php
, beforeEzPublishCoreBundle
, but afterFOSHttpCacheBundle
:
public function registerBundles()
{
$bundles = array(
// ...
new FOS\HttpCacheBundle\FOSHttpCacheBundle(),
new EzSystems\PlatformHttpCacheBundle\EzSystemsPlatformHttpCacheBundle(),
new eZ\Bundle\EzPublishCoreBundle\EzPublishCoreBundle(),
// ...
);
The package will replace several services from the kernel, thus enabling the new features, such as multi-tagging.
- The application cache class needs to be customized. This is done by modifying
AppCache
class, you will have to make it extendEzSystems\PlatformHttpCacheBundle\AppCache
.
Do not forget to restart your web server.
For usage with Varnish see the dedicated document in docs/varnish
Responses from /content/view
will be tagged based on their contents:
curl -i -X HEAD 'http://localhost:8000/'
HTTP/1.1 200 OK
Host: localhost:8000
Connection: close
Cache-Control: public, s-maxage=60
Content-Type: text/html; charset=UTF-8
Vary: X-User-Hash
xkey: content-1 content-type-1 location-2 parent-1 path-1 path-2 ez-all
For further reading on tags see docs/using_tags.md.
Responses from /content/view
will be made cachable, and the shared max age will be set if it is enabled.
A set of Slots will send HTTP PURGE requests for each cache tag affected by write operations.
This bundle lets you configure drivers for handling HTTP cache. The following exists from eZ:
local
: extended Symfony Proxy to support tagging and varying by user rights (available in this bundle)http
akavarnish
: Varnish proxy using and customizing FosHttpCache for purging (available in this bundle)fastly
: Fastly CDN proxy (available with eZ Platform Enterprise and documented separately)
Configuring these is done using global ezpublish.http_cache.purge_type
config. By default it is set to use
%purge_type%
parameter, and can be set in app/config/parameters.yml
like so:
parameters:
purge_type: varnish
For further reading on drivers see docs/drivers.md.
For further reading on tags see docs/using_tags.md.