I am trying to cache static content, I want this content is have a lifetime of one hour and the content is public, it is the same for everyone.
I have the following code in my controller:
$response = new Response();
$response->setPublic();
$response->setMaxAge(3600);
$response->setSharedMaxAge(3600);
if ($response->isNotModified($request)) {
return $response;
}
return $this->render(
'ThemesBundle:Ad:content.html.twig',
array('context' => $context, 'block' => $block),
$response
);
But the isNotModified()
function always returns false.
PS: I am using Symfony 2.0.22