Reputation: 3
I'm currently developing an application based on symfony2. It's my first dealing with this framework and I have a question regarding twig template caching.
How does it manage templates with dynamic content? Say you have a template with this code somewhere in it:
{% for i in messages %}
i.content
{% endfor %}
I assume this cannot really be cached as is, so does twig do something with it? I'm asking because I'm starting to think that this type of code is not cached at all and the thing is, I did it almost everywhere in my app. So maybe going back to plain PHP would give me greater perf. Currently the twig engine is taking half of the page generation! If someone could advise me on it It would be great!
Thanks for your responses and sorry for my english. Cheers
Upvotes: 0
Views: 2081
Reputation: 12033
If your question relates only to caching compiled twig templates, then the .twig files compiled into a simple php files every time the page is processed in the dev environment. In the prod environment they are compiled only once. You can check app/cache
folder to see result php files. Totally choose of template engine does not matter in prod environment.
If you asking about caching html result or controller parts read about it in officical documentaion.
Upvotes: 1