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