Message-ID: <1975642744.4336.1485866212031.JavaMail.confluence@ip-10-127-227-164> Subject: Exported From Confluence MIME-Version: 1.0 Content-Type: multipart/related; boundary="----=_Part_4335_933904526.1485866212031" ------=_Part_4335_933904526.1485866212031 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Content-Location: file:///C:/exported.html HttpCache

HttpCache

Content Cache

Limitation

Shared HTTP cache is only available for anonymous users. Logged in users= will be served the same cache as for anonymous users, except for restricte= d access.

For personal information display, you must use sub-requests with= ESI or Hinclude. Sub-controller would not use cache or make the c= ached response vary with Cookie (individual cache).

eZ Publish uses <= /span>Symfony HttpCache to manage content cache, with both expiration and validation model. Hence an ETag is computed for every content/version and sent = in the Http response. It is also possible to use expiration model to get li= ghtning fast responses.

An additional X-Location-Id header is added in the resp= onse for identification (see cache purge d= ocument).

Configuration

=20
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

Making your cont= roller content cache aware

Sometimes you need that your controller's cache expires in the same time= than a specific content (i.e. ESI sub-requests with render twig helper, for a me= nu for instance). To be able to do that, you just need to add X-Loc= ation-Id header to the response object:

=20
use Symfony\Component\HttpFoundation\Response;
 
// In a controller
// "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

 

------=_Part_4335_933904526.1485866212031--