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

HttpCache

=20 =20

Conten= t Cache

 

eZ Publish uses Symfony HttpCache to m= anage content "view" cache with the expiration model.

An additional X-Location-Id header is added in the resp= onse for identification (for details see cac= he purge document).

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

Making your control= ler user cache aware

If the content you're rendering depends on the user permissions, then an= additional header must be set for this as explained in Context aware HTTP cache 

 

------=_Part_3065_428656556.1485851838733--