The Twig cache isn't working in Slim routes

50 views Asked by At

It might sound a bit vague, but I'd like to know if anyone has had issues using Twig cache in Slim routes and managed to resolve them somehow.

I passed the parameter to use cache in the global Twig container loading, but it still seems not to use the cache in the routes that render directly in the Action.

$twig = new Environment($loader, ['debug' => true, 'cache' => sys_get_temp_dir()]);
No action está renderizando assim;
/** @var Environment $twig */
        $twig = $this->container->get('twig');
        return $twig
            ->load('exemplo/resultado.twig')
            ->render([
                'dados' => array_map(
                    static fn(Resultado $resultado) => $resultado->jsonSerialize(),
                    $arrResultados
                ),
            ]);`
0

There are 0 answers