|
Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon. |
|
View previous topic :: View next topic |
Author |
Message |
simplex Smarty n00b
Joined: 03 Apr 2021 Posts: 4
|
Posted: Sat Apr 03, 2021 8:51 pm Post subject: Caching with Smarty - A few best practice questions |
|
|
Hi,
I have played around with caching a bit, and I have to say that I was surprised how simple and painless it was. with just a few lines of additional code, the massive smarty frontend was cached, with just a few small issues, that can be easily solved by a few more lines of code
My question is this: Having a cached smarty frontend is nice, however, in my case, all the PHP code which is needed for the frontend, is still executed. So as you can imagine, load time savings were not really there. What are the best practices to only execute the PHP code that is needed for the uncached stuff?
All I can think off is using isCached() and depending on the result, decide which php code to execute.
Am I on the right path with this, or are there better ways?
Cheers |
|
Back to top |
|
AnrDaemon Administrator
Joined: 03 Dec 2012 Posts: 1785
|
Posted: Sun Apr 04, 2021 4:53 pm Post subject: |
|
|
That's basically the only way to do it.
Carefully inspect your code, group stuff that only calculate template variables, and wrap it into if(!isCached()) block. |
|
Back to top |
|
simplex Smarty n00b
Joined: 03 Apr 2021 Posts: 4
|
Posted: Mon Apr 05, 2021 2:03 pm Post subject: |
|
|
AnrDaemon wrote: | That's basically the only way to do it.
Carefully inspect your code, group stuff that only calculate template variables, and wrap it into if(!isCached()) block. |
Thanks for the info. |
|
Back to top |
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|