This page explains the content cache purge (aka invalidate) mechanism , while 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.
Overview
As explained on on the HttpCache page, eZ Platform return returns content-related responses with a an X-Location-Id
header that are stored together by the configured http HTTP cache. This allows you to clear (invalidate) http HTTP cache representing specifically a given contentContent item. On publishing the content publish, a cache purger is triggered with the content id Content ID in question, which in turn figures out affected content locations Locations based on Smart HttpCache HTTP cache clearing logic, the returned location id's . The returned Location IDs are sent for purge using the purge type explained further explained below.
Purge types
Symfony Proxy: Local purge type
By default, invalidation requests will be emulated and sent to the Symfony Proxy cache Store. Cache purge will thus be synchronous, meaning no Http HTTP purge requests will be sent around when publishing.
Code Block | ||
---|---|---|
| ||
ezpublish: http_cache: purge_type: local |
Varnish:
...
HTTP purge type
With Varnish you can configure one or several severs servers that should be purged over HTTP, this . This purge type is asynchronous, and flushed by the end of symfony Symfony kernel-request/console cycle (during terminate event). Setting Settings for purge servers can be configured per site group or site access:
...
Purging
While purging on content, updates are handled for you, ; on actions against the eZ Platform API'sAPIs, there are times you might have to purge manually.
...
Manual purging from code which takes Smart HttpCache clearing logic into account, this is using the service also used internally for cache clearing on content updates:
...
Manually by command with Symfony Proxy
Symfony Proxy stores it's its cache in the symfony Symfony cache directory, so a regular cache:clear
commands will clear it:
Code Block | ||
---|---|---|
| ||
php app/console --env=prod cache:clear |
Manual by
...
HTTP BAN request on Varnish
When using Varnish and in need to purge content directly, then the following examples shows show how this is done internally by our FOSPurgeClient, and in turn FOSHttpCache Varnish proxy client:
...