Smarty Forum Index Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon.

caching and database access

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> General
View previous topic :: View next topic  
Author Message
datamile
Smarty Rookie


Joined: 17 May 2003
Posts: 13

PostPosted: Sat May 17, 2003 10:21 am    Post subject: caching and database access Reply with quote

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
View user's profile Send private message
messju
Administrator


Joined: 16 Apr 2003
Posts: 3336
Location: Oldenburg, Germany

PostPosted: Sat May 17, 2003 10:35 am    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> General All times are GMT
Page 1 of 1

 
Jump to:  
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
Protected by Anti-Spam ACP