Re: [SMARTY] clear_cache unexpected behavior

From: Date: Thu, 13 Feb 2003 11:35:08 +0000
Subject: Re: [SMARTY] clear_cache unexpected behavior
References: 1 2 3 4  Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-7722@lists.php.net to get a copy of this message
Monte, I'm experiencing a related problem and would like to use your example since I'm in the middle of implementation (now retreated to using smarty 2.3.1). It turns out that the following call does work clear_cache(null, 'C'); However, if I put a template name it doesn't work. in my case, the 'foo.tpl' of the example is actually a 'browse/_index.tpl'. So, clear_cache('browse/_index.tpl', 'C') doesn't work. That forces me to be extra careful with my cache id namespace; I wasn't counting on having unique cache id but instead unique 'cache id/template name' pairs. Perhaps it has to do with the fact that I'm using subdirectories to organize my templates. FYI: I'm also setting up my template directory via $this->template_dir. ubaldo www.loquo.com P.S. BTW Once I switched back to smarty 2.3.1 I also hit the directory name '0' bug; Thank god they're is an archive. ----- Original Message ----- From: "Monte Ohrt" <monte@ispi.net> To: "Ubaldo Huerta" <ubaldo@loquo.com> Cc: "Smarty General" <smarty-general@lists.php.net> Sent: Wednesday, February 12, 2003 4:12 PM Subject: Re: [SMARTY] clear_cache unexpected behavior > If you want cache files treated as a group, you must explicitly group > them. Otherwise there would be no way to remove a single cache for a > template without wiping out all the groups beneath it. > > Monte > > On Wed, 2003-02-12 at 09:01, Ubaldo Huerta wrote: > > Got it. > > > > If I understand it, what you're saying is that in order to wipe out all the > > caches for one template, I have to use a somewhat artificial "parent" group > > id ('C' in your example). > > > > That's fine, however, I think it will be a nice addition to smarty to have a > > mechanism to do this without the need for 'C' > > > > Clearly, as you pointed out (and didn't occurred to me) > > clear_cache('foo.tpl') only clears the caches with no cache id. > > > > Thank you for your help. > > > > Ubaldo > > > > LoQUo Barcelona Community > > www.loquo.com > > > > ----- Original Message ----- > > From: "Monte Ohrt" <monte@ispi.net> > > To: "Ubaldo Huerta" <ubaldo@loquo.com> > > Cc: "Smarty General" <smarty-general@lists.php.net> > > Sent: Wednesday, February 12, 2003 3:37 PM > > Subject: Re: [SMARTY] clear_cache unexpected behavior > > > > > > > That's not how it works. If you don't supply a group id, then Smarty > > > will not know any grouping association and only clear the single cache > > > file for the 'foo.tpl' template as if you called: > > > > > > $smarty->display('foo.tpl'); > > > > > > If you want to clear a group of templates, you must supply a group id. > > > > > > You could do something like this: > > > > > > display('foo.tpl', 'C|0|1', 'english') // first page > > > of > > > display('foo.tpl', 'C|0|2', 'spanish) > > > display('foo.tpl', 'C|1|1', 'catalan') > > > > > > Then to clear them all: > > > > > > clear_cache('foo.tpl', 'C') > > > > > > > > > Monte > > > > > > On Wed, 2003-02-12 at 07:25, Ubaldo Huerta wrote: > > > > Hi all, > > > > > > > > I'm wondering if it's my misunderstanding of the way the API should work > > or if it's simply a bug (hard to believe given the maturity of smarty). I've > > been using it myself for more 5 months now in production and it's remarkably > > predictable. > > > > > > > > So the question is: > > > > > > > > Shouldn't clear_cache('foo.tpl') clear all caches for that > > > > template, > > period? I'm observing that this is NOT happening. > > > > > > > > In my particular setup, I'm using compile id (because it's handy to do > > multilanguage sites) and also cache groups (because I'm caching pages in a > > result set', that is, I'm calling display in the following way > > > > > > > > display('foo.tpl', '0|1', 'english') // first > > > > page of > > > > display('foo.tpl', '0|2', 'spanish) > > > > display('foo.tpl', '1|1', 'catalan') > > > > ... so on .... > > > > > > > > So, my goal is to get rid of all caches (all languages) for all pages, > > so I thought that > > > > clear_cache('foo.tpl') should do it, but it doesn't seem to work. Note > > that the following DOES work: > > > > > > > > clear_cache('foo.tpl', '0') > > > > clear_cache('foo.tpl', '1') > > > > and so on .... > > > > > > > > but that'll force me to keep track of all possible cache ids for > > template 'foo.tpl'. > > > > > > > > Am I making any sense? > > > > > > > > BTW, I tried it with Smarty 2.4.2 and still didn't work > > > > > > > > Thank you. > > > > > > > > Ubaldo > > > > > > > > LoQUo Barcelona Community > > > > www.loquo.com > > > -- > > > Monte Ohrt <monte@ispi.net> > > > > > > > > > -- > > > Smarty General Mailing List (http://smarty.php.net/) > > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > > > > > > > -- > Monte Ohrt <monte@ispi.net> > > > -- > Smarty General Mailing List (http://smarty.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > >

« previous php.smarty.general (#7722) next »