Message-ID: <649043304.3996.1485856244660.JavaMail.confluence@ip-10-127-227-164> Subject: Exported From Confluence MIME-Version: 1.0 Content-Type: multipart/related; boundary="----=_Part_3995_1138116804.1485856244660" ------=_Part_3995_1138116804.1485856244660 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Content-Location: file:///C:/exported.html
eZ Platform uses Symfony HttpCache to = manage content "view" cache with an expiration model. In addition it is extended = (using FOSHttpCache) to add several advanced features. For content com= ing from the CMS the following is taken advantage of out of the box:
X-Location-Id
header, which both Symfony and=
Varnish Proxy are able to invalidate cache on (for details see cache purge document.)X-User-Hash
to allow pages to va=
r by user rights (so not per unique user, that is better se=
rved by browser cache.)ezpublish: system: my_siteaccess: content: view_cache: true # Activates HttpCache for content ttl_cache: true # Activates expiration based HttpCach= e for content (very fast) default_ttl: 60 # Number of seconds an Http response = is valid in cache (if ttl_cache is true)=20
Sometimes you need your controller's cache to be invalidated at the same=
time as specific content changes (i.e. ESI sub-requests with render
twig helper,=
for a menu for instance). To be able to do that, you just need to add
use Symfony\Component\HttpFoundation\Response; // Inside a controller action // "Connects" the response to location #123 and sets a max age (TTL) of 1 h= our. $response =3D new Response(); $response->headers->set('X-Location-Id', 123); $response->setSharedMaxAge(3600);=20
If the content you're rendering depends on a user's permissions, then yo= u should make the response Context-aware:
use Symfony\Component\HttpFoundation\Response; // Inside a controller action // Tells proxy configured to support this header to take the rights of a us= er (user hash) into account for the cache $response =3D new Response(); $response->setVary('X-User-Hash');=20