Re: [SMARTY] caching problem

From: Date: Fri, 20 Sep 2002 18:40:41 +0000
Subject: Re: [SMARTY] caching problem
Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-6003@lists.php.net to get a copy of this message
Sorry about my email provider mangling the message with HTML special characters conversion, hopefully corrected below. One more piece to the puzzle. When I regenerate all of the content, the one box that is not caching actually displays the prior cached content, then leave the content uncached. This is especially confusing becuase all of the code goes through a function that looks like: switch($box) { case BOX1: //code to gen $t->assign(...); case BOX2: //code to gen $t->assign(...); default: //raise error return; } $t->clear_cache($thisbox_tpl, $box_cacheid); if ($show) { $t->display($thisbox_tpl, $box_cacheid); } else { $t->fetch($thisbox_tpl, $box_cacheid); } The clear_cache and display/fetch are outside of the case statement and are therefore the same for all boxes?!? Jason > I am experiencing a clear_cache problem I am unable to > resolve. I have an application that is basically: > > page.tpl <- overall layout, never cached > (caching=0, cache_lifetime=1) > | > +- box.tpl <- layout template for a "box", never cached > .| > .+- content1.tpl <- one style of box "content", caching=1, cache_lifetime=-1 > .+- content2.tpl <- another flavor of "content" same caching parameters > > If I call the page using a certain parameter, it will > generate the content (often using a db query that > takes some time) then do the following: > > NOTE: this code snippet is contained within the > gen_graph function > $t->clear_cache($thisbox_tpl, $box_cacheid); > // fetch and throw away the result to set the cache > $t->fetch($thisbox_tpl, $box_cacheid); > > All of the "boxes" are set up inside of a loop > that does: > if (!$t->is_cached($thisbox_tpl, $box_cacheid)) { > gen_graph($p_box_type); > } > $box_info['title'] = dashbox_title($p_box_type); > $box_info['content'] = $t->fetch($thisbox_tpl, > $box_cacheid); > > I have a cron job set up to fetch the page in the > content regenerating mode. > > The problem I have is that sometimes when I fetch the > page (in the "normal" mode where everything > should be cached) and one of the boxes is not cached > (a particular one that takes 215 seconds to generate). > Once a user hits this page and waits for the content > to generate, subsequent pages are cached and retrieve > quickly...until the next time the cache is > mysteriously cleared. > > I have been fighting this code for several days trying > to find the bug, including upgrading to Smarty 2.3.0, > and even trying the use_sub_dirs=false; to see if it > would make any difference. I do use the same > "content" template with different cacheids, so > I did check the code to make sure that every time I > call the clear_cache function, it also has the cacheid > parameter. Does anyone have a suggestion that may > help my situation? > > TIA > > Jason

« previous php.smarty.general (#6003) next »