Re: Smarty compiling & caching issues - possible solution
| From: | Monte Ohrt | Date: | Sat, 06 Oct 2001 16:49:48 +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-1619@lists.php.net to get a copy of this message | ||
If you ftp to your server and update a template, how would your
application know that it was updated? You are covering the situation
where templates are updated by the application. This isn't always the
case.
Jason Sweat wrote:
>
> Set your cache time even longer, and just have your application clear the
> cache when an update is made. This can be particularly effective when using
> relevant cache id's, i.e. if there are 10 main areas in your app, cache each
> one in Smarty with a cache id of page#, then if you change something in the
> 7th section, do t->clear_cache('page7');
>
> or just to $t->clear_all_cache();
> to restart everything.
>
> ----- Original Message -----
> From: "Bob" <whyisityou2@yahoo.com>
> To: <smarty@lists.ispi.net>
> Cc: <smarty@lists.ispi.net>
> Sent: Saturday, October 06, 2001 4:53 AM
> Subject: [smarty] Re: Smarty compiling & caching issues - possible solution
>
> > 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
> >
> >
> >
> >
> > ---
> > You are currently subscribed to smarty as: sweatjejm@home.com
> > To unsubscribe send a blank email to $subst('Email.Unsub')
> > Visit Smarty's homepage at
> > http://www.phpinsider.com/php/code/Smarty/
>
> ---
> You are currently subscribed to smarty as: monte@ispi.net
> To unsubscribe send a blank email to $subst('Email.Unsub')
> Visit Smarty's homepage at
> http://www.phpinsider.com/php/code/Smarty/