caching problem
| From: | Jason Sweat | Date: | Fri, 20 Sep 2002 16:45:41 +0000 |
| Subject: | caching problem | ||
| Groups: | php.smarty.general | ||
| Request: | Send a blank email to php-smarty-general+get-6001@lists.php.net to get a copy of this message | ||
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
__________________________________________________
Do you Yahoo!?
New DSL Internet Access from SBC & Yahoo!
http://sbc.yahoo.com