Smarty Forum Index Smarty
The discussions here are for Smarty, a template engine for the PHP programming language.
Need help to implement Smarty page caching

 
Post new topic   Reply to topic    Smarty Forum Index -> Help Wanted (commercial)
View previous topic :: View next topic  
Author Message
bolabola
Smarty n00b


Joined: 30 Jan 2013
Posts: 3

PostPosted: Wed Jan 30, 2013 1:01 pm    Post subject: Need help to implement Smarty page caching Reply with quote

I have a Smarty-based website that receives a high volume of traffic (about 1 million monthly page views).

The site is running on a VPS hosting account but at times under heavy load can be quite slow.

I'd like to implement caching with Smarty so that every page on the website is cached for 15 minutes to 1 hour depending on the page content.

Looking for someone with similar experience who can help implement this on my site.

The site is www.jobvark.ca.

Thanks.
Back to top
View user's profile Send private message
mohrt
Administrator


Joined: 16 Apr 2003
Posts: 7269
Location: Lincoln Nebraska, USA

PostPosted: Wed Jan 30, 2013 3:05 pm    Post subject: Reply with quote

This will get you started:

Code:
$smarty->setCaching(Smarty::CACHING_LIFETIME_CURRENT);
$smarty->setCacheLifetime(60 * 15); // 15 minute cache


You want to change the lifetime setting depending on page content, as you stated. Do this before $smarty->display(...) calls.
Back to top
View user's profile Send private message Visit poster's website
bolabola
Smarty n00b


Joined: 30 Jan 2013
Posts: 3

PostPosted: Wed Jan 30, 2013 3:08 pm    Post subject: Reply with quote

mohrt wrote:
This will get you started:

Code:
$smarty->setCaching(Smarty::CACHING_LIFETIME_CURRENT);
$smarty->setCacheLifetime(60 * 15); // 15 minute cache


You want to change the lifetime setting depending on page content, as you stated. Do this before $smarty->display(...) calls.


Where is this code inserted? In index.php?
Back to top
View user's profile Send private message
U.Tews
Administrator


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

PostPosted: Wed Jan 30, 2013 8:55 pm    Post subject: Reply with quote

You must do it in index.php and any other php script file which might be called to display() a page.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Smarty Forum Index -> Help Wanted (commercial) 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