HttpCache
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.)
- 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.)
Cache and Expiration Configuration
ezplatform.yml
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:
In this section
- Purge This page explains the content cache purge (aka invalidate) mechanism used when publishing content from the UI or from a container-aware script, resulting in cache being invalidated either in the built-in Symfony Reverse Proxy, or on the much faster Varnish reverse proxy.
- Smart HTTP cache clearing Smart HTTP cache clearing refers to the ability to clear cache for Locations/content that is in relation with the content being currently cleared.
Contributors
- Jérôme Vieilledent
- Dominika Kurek Updated
Comments
Add a comment