Content Cache
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 coming from the CMS the following is taken advantage of out of the box:
- To be able to always keep cache up to date, cache is made "content-aware" to allow updates to content to trigger cache invalidation.
- Uses a custom
X-Location-Id
header, which both Symfony and Varnish Proxy are able to invalidate cache on (for details see cache purge document.)
- Uses a custom
- To be able to also cache requests by logged-in users, cache is made "Context-Aware."
- Uses a custom vary header
X-User-Hash
to allow pages to var by user rights (so not per unique user, that is better served by browser cache.)
- Uses a custom vary header
Cache and Expiration Configuration
Making your controller response content-aware
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 X-Location-Id
header to the response object:
Making your controller response context-aware
If the content you're rendering depends on a user's permissions, then you should make the response Context-aware: