Re: Smarty compiling & caching issues - possible solution
| From: | Bob | Date: | Sat, 06 Oct 2001 09:53:40 +0000 |
| Subject: | Re: Smarty compiling & caching issues - possible solution | ||
| References: | 1 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-1616@lists.php.net to get a copy of this message | ||
If I have caching enabled for 1 hour then any content I change will be done
within an hour, right? Plus, I'm assuming you have caching turned on
because you have a high traffic site so it would seem like that is the trade
off you have to decide.
If you want speed by caching then you have to delay the time your site is
updated.
If you want real time updates then you have to put more load on your
database.
Am I off here or what?
Monte Ohrt wrote:
> There is an issue that has been coming up repeatedly on the mailing
> list, which I will address here.
>
> Currently if you have caching enabled it overrides the compile_check
> flag, meaning that if a template's contents changes you don't see them
> until the cache expires. If you want to force the change, you must turn
> caching off, turn compile_check on, clear the cache directory manually
> and reload the page. Several requests have been made to automatically
> clear cache files whenever a template is recompiled, and do this when
> compile_check is true, regardless of the caching setting.
>
> I've been working on a solution, and it will require a fundamental
> change in the way Smarty behaves. Currently, caching overrides the
> compile_check flag. This means that after a template compiles once, the
> cached version is used until it expires, regardless if a template
> changes during that time or not.
>
> At first I thought this would be easy to fix. If caching is true and
> compile_check is true, process the template. If it needed a recomiple,
> then clear the cache file. But what happens if a template included by
> the main template was changed? You won't see the changes because the
> cached file is based on the top level template.
>
> So, the sensible solution is to _always_ clear the cache file when
> caching is true and compile_check is true. This essentially disables
> caching altogether whenever compile_check is enabled. Or another way to
> put it, compile_check now overrides caching instead of the other way
> around.
>
> The PROS: Anytime you have compile_check enabled, template changes are
> always seen, regardless of cache setting.
>
> The CONS: Anyone who currently has caching on and compile_check on will
> no longer benefit from caching, the behavior CHANGED.
>
> Thoughts? Anything I missed?
>
> Here is the simple change in Smarty to make this happen:
>
> if($this->compile_check) {
> $this->caching = false;
> }
>
> Monte
>
> --
> Monte Ohrt <monte@ispi.net>
> http://www.ispi.net/
>
> ---
> You are currently subscribed to smarty as: whyisityou2@yahoo.com
> To unsubscribe send a blank email to $subst('Email.Unsub')
> Visit Smarty's homepage at
> http://www.phpinsider.com/php/code/Smarty/
_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com