Re: [SMARTY] clear_cache unexpected behavior

From: Date: Wed, 12 Feb 2003 21:04:19 +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-7698@lists.php.net to get a copy of this message
Got it. I guess that some people got confused in the past about the behavior of clear_cache() and even try to "fix" it See http://marc.theaimsgroup.com/?l=smarty-general&m=103264502408258&w=2 Perhaps the doc should say that clear_cache('foo.tpl') only clears the cache with cache_id=null. I couldn't infer that from this piece of documentation >>>>>>>>>>>>>>>>>>>>>>>> Example 13-8. clear_cache // clear the cache for a template $smarty->clear_cache("index.tpl"); // clear the cache for a particular cache id in an multiple-cache template $smarty->clear_cache("index.tpl","CACHEID"); >>>>>>>>>>>>>>>>>>>>>>>> Thank you for your help. ubaldo 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 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 (#7698) next »