Smarty Forum Index Smarty
The discussions here are for Smarty, a template engine for the PHP programming language.
Dedicated server web hosting provided by Guru-host.eu.
I have some caching problem to sort out

 
Post new topic   Reply to topic    Smarty Forum Index -> General
View previous topic :: View next topic  
Author Message
Jemshope
Smarty n00b


Joined: 12 Jan 2012
Posts: 1

PostPosted: Fri Jan 13, 2012 3:20 am    Post subject: I have some caching problem to sort out Reply with quote

I have some caching problem to sort out. When I use one variable 'view', it is working fine but when I want to use two variables 'view' and 'id' then i make no sense and wont work for mee. So - is it possible to cache the page as an unique page and use more then one variable? How to?
Back to top
View user's profile Send private message
douglassdavis
Smarty Junkie


Joined: 21 Jan 2008
Posts: 524

PostPosted: Fri Jan 13, 2012 11:50 am    Post subject: Re: I have some caching problem to sort out Reply with quote

Jemshope wrote:
I have some caching problem to sort out. When I use one variable 'view', it is working fine but when I want to use two variables 'view' and 'id' then i make no sense and wont work for mee. So - is it possible to cache the page as an unique page and use more then one variable? How to?


do you mean like:

$cache_id = $view.','.$id
Back to top
View user's profile Send private message
rodneyrehm
Administrator


Joined: 30 Mar 2007
Posts: 698
Location: Germany, border to Switzerland

PostPosted: Fri Jan 13, 2012 12:50 pm    Post subject: Re: I have some caching problem to sort out Reply with quote

douglassdavis wrote:
$cache_id = $view.','.$id


If your cache_id forms a hierarchy (much like a directory structure) you should delimit the components with a | (pipe). Only then is smarty able to also kill the cache of "view|123" when you clearCache(null, "view")
_________________
Twitter
Back to top
View user's profile Send private message Visit poster's website
dough boy
Smarty Rookie


Joined: 31 Mar 2006
Posts: 32

PostPosted: Sat Mar 10, 2012 9:27 pm    Post subject: Reply with quote

Sorry to step on this topic, but are you saying if I did something like:

Code:

$cache_id = 'a|b|1';
$cache_id = 'a|b|2';
$cache_id = 'a|b|n';

$smarty->clearCache(null, 'a|b|1'); # resets only 'a|b|1'
$smarty->clearCache(null, 'a|b'); # resets all under 'a|b' (1, 2, n)
$smarty->clearCache(null, 'a'); # resets all under 'a'  (b1, b2, bn)
Back to top
View user's profile Send private message
rodneyrehm
Administrator


Joined: 30 Mar 2007
Posts: 698
Location: Germany, border to Switzerland

PostPosted: Sat Mar 10, 2012 9:28 pm    Post subject: Reply with quote

dough boy wrote:
Sorry to step on this topic, but are you saying if I did something like: …


that is the general idea, yes.
_________________
Twitter
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    Smarty Forum Index -> General All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP