Smarty Forum Index Smarty
The discussions here are for Smarty, a template engine for the PHP programming language.
cache tag with duration

 
Post new topic   Reply to topic    Smarty Forum Index -> Feature Requests
View previous topic :: View next topic  
Author Message
adn
Smarty Regular


Joined: 31 May 2011
Posts: 67

PostPosted: Sat Mar 24, 2012 5:54 pm    Post subject: cache tag with duration Reply with quote

Hello,

I would suggest to have the ability to define a duration time in seconds on the cache tag, something like

{nocache duration=3600}
.....
{/nocache}


In my main template I have several nocache section and I like first to be able to define the time duration and also a different duration: one section with 15 minutes, an other every 24h etc...

Thanks
Back to top
View user's profile Send private message Visit poster's website
U.Tews
Administrator


Joined: 22 Nov 2006
Posts: 4668
Location: Hamburg / Germany

PostPosted: Sat Mar 24, 2012 6:21 pm    Post subject: Reply with quote

This does not make sense because you would still need to assign the variables used in the {nocache} at each page call. So you gain no performance.

You can specify individual cache life times with {include} for subtemplates. But this does add the overhead of a second cache file.

So in most cases different life times do not make sense performance wise.
Back to top
View user's profile Send private message
adn
Smarty Regular


Joined: 31 May 2011
Posts: 67

PostPosted: Sun Mar 25, 2012 10:15 am    Post subject: Reply with quote

Thanks for your explaination.
I didn't know that cache_lifetime was usable on include.

Using this attribute on include need to have Smarty::CACHING_LIFETIME_SAVED activated I suppose
Back to top
View user's profile Send private message Visit poster's website
U.Tews
Administrator


Joined: 22 Nov 2006
Posts: 4668
Location: Hamburg / Germany

PostPosted: Sun Mar 25, 2012 10:53 am    Post subject: Reply with quote

Smarty::CACHING_LIFETIME_SAVED is not necessary.
Back to top
View user's profile Send private message
adn
Smarty Regular


Joined: 31 May 2011
Posts: 67

PostPosted: Sun Mar 25, 2012 12:09 pm    Post subject: Reply with quote

One more question, is that compatible with INLINE attribute?
Thanks !!
Back to top
View user's profile Send private message Visit poster's website
U.Tews
Administrator


Joined: 22 Nov 2006
Posts: 4668
Location: Hamburg / Germany

PostPosted: Sun Mar 25, 2012 12:30 pm    Post subject: Reply with quote

No, if you use individual caching it does disable the global $merge_compiled_includes setting and the inline attribute for the included subtemplate.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Smarty Forum Index -> Feature Requests 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