Commit fac3649a authored by Ben Longden's avatar Ben Longden

Updated to use setTtl

Previous version set Cache-Control s-maxage headers explicitly which is
not enough to trigger ESI caching in the reverse proxy. Using setTtl is
enough to make this work correctly.
parent 810fcb19
......@@ -59,7 +59,7 @@ Silex applications by using the ``http_cache`` service::
The provider also provides ESI support::
$app->get('/', function() {
return new Response(<<<EOF
$response = new Response(<<<EOF
<html>
<body>
Hello
......@@ -69,15 +69,17 @@ The provider also provides ESI support::
EOF
, 200, array(
'Cache-Control' => 's-maxage=20',
'Surrogate-Control' => 'content="ESI/1.0"',
));
$response->setTtl(20);
return $response;
});
$app->get('/included', function() {
return new Response('Foo', 200, array(
'Cache-Control' => 's-maxage=5',
));
$response = new Response('Foo');
$response->setTtl(5);
return $response;
});
$app['http_cache']->run();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment