a tiny thing that worries me
| From: | Rasmus Schultz | Date: | Wed, 04 Dec 2002 21:18:57 +0000 |
| Subject: | a tiny thing that worries me | ||
| Groups: | php.smarty.general | ||
| Request: | Send a blank email to php-smarty-general+get-6640@lists.php.net to get a copy of this message | ||
there's one tiny thing that's been nagging at my mind
for some time now - about caching ... take this example:
if (!$smarty->is_cached("my.tpl")) {
$smarty->assign...
etc.
}
$smarty->display("my.tpl");
now I'm checking first, if the page is cached - and so
I can't help but wonder, what happens if the cache expires
JUST after I perform the first check? the function would
return true, and consequently I would not perform database
operations or assign variables for the template, which
when display is called just afterwards, would result in
a bad page/missing content.
I know that the odds of this happening are minimal, but
the possibility is there, and it's this sort of thing that
can cause tiny, unpredictable errors in large systems.
I actually presume that is_cached remembers it's result
when it's first called, so that when the display function
has to check if the page is called, it gets the result
from the previous is_cached check? I mean, that's how it
ought to work, but I'd just like to be sure ... any of
the programmers would like to comment on this?
I'm probably just being paranoid :)