webvariants / esi
AddOn for SallyCMS, Edge Side Includes for Sally
dev-default / 0.x-dev
2013-10-07 15:26 UTC
Requires
- php: >=5.3.3
- sallycms/composer-installer: ~1.1
- sallycms/sallycms: >=0.9,<0.10
This package is not auto-updated.
Last update: 2020-08-17 09:31:15 UTC
README
1. Usage
- Setup ESI configuration in
develop/config/esi.yml
- Setup your Varnish
- see Symfony 2 documentation about Varnish
set req.http.Varnish-Trust-Secret = "xyz_random";
- To cache a template call
sly_Util_ESI::renderTemplate
:
sly_Util_ESI::renderTemplate('footer', array('a' => 1), array('max-age' => 10));
The template parameters must be scalars, nested arrays with scalars work too. Just everthing that survives
http_build_query
Inside the template you have the local variables $response
(sly_Response
), $esi
(bool
) and
parameters. Use $response
to set the cache directives (ex.
$response->addCacheControlDirective('max-age', 300);
). $esi
is true
when the caching works though
varnish or sally cache.