|
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 |
datamile Smarty Rookie
Joined: 17 May 2003 Posts: 13
|
Posted: Sat May 17, 2003 10:21 am Post subject: caching and database access |
|
|
hi, I've got a 2.3 app which I'm looking to upgrade to 2.5 with caching.
I'm looking at caching around the database access if the page is already cache.
Can the following happen.
is_cache = true , so don't do db access and go straight to display , but between the test and the display the cache has been cleared ?
If this was possible then I could get blank pages etc. |
|
Back to top |
|
messju Administrator
Joined: 16 Apr 2003 Posts: 3336 Location: Oldenburg, Germany
|
Posted: Sat May 17, 2003 10:35 am Post subject: |
|
|
no this shouldn't happen.
if you do sth like:
Code: |
if (!$smarty->is_cached($tpl_file, $cache_id)) {
[expensive db stuff}
}
$smarty->display($tpl_file, $cache_id);
|
then the template is already fetched from the cache after the is_cached() returned true. that means the display-call later on will *always* use the cached version. you are just not allowed to change $tpl_file or $cache_id in between, of course.
HTH
messju |
|
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
|