webvariants / esi
AddOn for SallyCMS, Edge Side Includes for Sally
This package's canonical repository appears to be gone and the package has been frozen as a result. Email us for help if needed.
Installs: 0
Dependents: 0
Suggesters: 0
Security: 0
Type:sallycms-addon
pkg:composer/webvariants/esi
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.