As far as I understand it, when you turn on caching in smarty, smarty caches compiled templates. These compiled templates can then used to speed up rendering of the page. Wouldn't it be a good idea to run you own level of caching on top of your smarty application that goes like this.
if(a cache for this page exists){
-Don't run my application, don't include my files don't instantiate my classes.
-Send the cached version of this page to the user
-end the script here
}else{//if the cache for this page does not exist or is not current
- run my application as usual
-save all the output to a file for next time
}
The whenever somthing happens on my site that would update the content of the this page, eg the admin makes changes to the content of the site delete the cache file. I feel like I must be missing something here. This method would allow me to store an all html version of every page and send that when it is valid. It seems like this would drastically improve the speed of my site.
Edit: Ok so I have discovered that smarty does infact store a html version of my site. How do I prevent my application from running if the rest of my application from running if the cache is current. Do I just include and instantiate smarty first and do something like
if($smarty->usingcache())[
exit;
}