2
我有一个控制器,其动作呈现在树枝的Symfony2:ESI setMaxAge缓存
{{ render_esi(controller('MyWebsiteBundle:Element:header')) }}
行动本身看起来是这样的:
/**
* @return Response
*/
public function headerAction()
{
$currentLocale = $this->getCurrentLocale();
$response = $this->render('MyWebsiteBundle:Element:header.html.twig', array(
'currentLocale' => $currentLocale,
'myTime' => time()
));
$response->setPublic();
$response->setSharedMaxAge(3600);
return $response;
}
当我重装我的浏览器中,"myTime"
每次更换。
我怎样才能使用setShardeMaxAge()
,这样Twig只会在MaxAge过期后呈现?
你使用'app_dev.php'或'app.php'访问页面? – nifr
目前我使用app_dev.php – Zwen2012
您是否在app_dev.php中启用了symfony的内部缓存代理AppCache([howto?](http://symfony.com/doc/current/book/http_cache.html) #symfony-reverse-proxy))? – nifr