I switched from Phptal to Twig: a very good experience. However, in phptal, I made "tal: cache" to cache some blocks of code ... with Twig, how can I do this?
You can cache blocks in a branch using this extension:
https://github.com/asm89/twig-cache-extension
It allows you to cache template blocks based on TTL, cache key changes, etc.
There is no explicit caching of certain blocks in a branch.
But twig caches intermediate code created from templates when it is not in debug mode.
Look here:http://symfony.com/doc/current/book/templating.html#twig-template-caching
This is in the context of symfony, but I think it will also work autonomously.Then you can specify it with the following values: Instruction Twig_Environment:
'cache' => 'cache/templates', // the place to cache to 'auto_reload' => true //reload template when changes are detected
Look here:http://twig.sensiolabs.org/doc/api.html#environment-options
Source: https://habr.com/ru/post/1436978/More articles:Strange behavior when I open Reportviewer in WPF - .netHow to register and track calls of NodeJS event and event handlers? - debuggingBootstrap-dropdown is hidden under the "main" page - twitter-bootstrapPHP => Inflate a GZipped string coming from C # SharpZipLib? - c #Find Missing Photos from Flickr, Facebook, Instagram and iPhoto - imageIs there something that prevents stack overflows in the assembly? - assemblyVim conflict syntax (using keyword) - vimAvoid primitive obsession with EventSourcing - c #How can I get time with MySql in Java? - javaFind String in DataTable - c #All Articles