I would like cache rendered controllers.
I have project in Symfony 3 and I found it: https://symfony.com/doc/3.4/http_cache/esi.html
I have:
framework:
# ...
esi: { enabled: true }
fragments: { path: /_fragment }
And in controller:
public function infoAction($maxPerPage)
{
$em = $this->getDoctrine()->getManager();
$info = $em->getRepository(Info::class)->find(1);
$response = $this->render('info.html.twig', [info => $info]);
$response->setSharedMaxAge(600);
return $response;
}
And in templates:
{{ render_esi(controller('AppBundle:News:info')) }}
I don't have any errors, and all is showing good, but this is not cached... If I change the data in the database, they are immediately displayed on the page, and should not appear until 600 seconds have passed.
What am I doing wrong?