serve cached files even though .tpl file that generated them changed?
| From: | DC | Date: | Fri, 23 Jan 2004 22:59:40 +0000 |
| Subject: | serve cached files even though .tpl file that generated them changed? | ||
| Groups: | php.smarty.general | ||
| Request: | Send a blank email to php-smarty-general+get-10867@lists.php.net to get a copy of this message | ||
I noticed a little problem with the cache system that I am sure can be
overcome.
For our setup, we serve Smarty's cached pages as 'static' published pages;
that is, we write a template that uses query variables to define cache
groups. Then we call 'em up one-by-one (using wget) to pre-cache every page
variation. We organize them using the cache groups feature, using query
variables as groups.
The problem is that I want to have *one* index.tpl file that serves and
controls caches of all of these page groups and every time I modify that
template file, Smarty considers the caches to be outdated. When Smarty gets
the iscached() call for that template it dutifully rebuilds the cache by
calling the databases. I haven't checked if Smarty actually erases the cache
file as soon as the .tpl file is changed but I suspect not.
I want to have control over *whether* Smarty should consider the cache
outdated and rebuild it. I want to be able to tell Smarty when I create the
cache with its cache group "Keep serving this cached page until I tell you
explicitly to stop. Pay no attention to the changing .tpl file" It may sound
kooky to you, but I want to be able to keep serving the cached files for
certain cache groups even though the .tpl file that originally generated
them has changed.
How can I tell Smarty to keep serving the cached pages even though the .tpl
file that spit them out in the first place has been modified?
Do I need to write a resource plugin and sire my own timestamp function?
What would the timestamp function return?
Do I need to define a cache_handler_func? I don't see anything in there
about timestamps or controlling cache creation. It doesn't look like I
handle the 'determination whether a cache is to be used' in this custom
function. It seems to handle only where the caches go.
Thanks for any hints!
Does Smarty have a variable that can be set to 'permanently' publish certain
cache groups? I looked all over and found nothing. You might also consider
this a feature request that grows out of the way we use Smarty to
pre-publish cached HTML pages.
Cheers,
dan