|
Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon. |
|
View previous topic :: View next topic |
Author |
Message |
bolabola Smarty n00b
Joined: 30 Jan 2013 Posts: 3
|
Posted: Wed Jan 30, 2013 1:01 pm Post subject: Need help to implement Smarty page caching |
|
|
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 |
|
mohrt Administrator
Joined: 16 Apr 2003 Posts: 7368 Location: Lincoln Nebraska, USA
|
Posted: Wed Jan 30, 2013 3:05 pm Post subject: |
|
|
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 |
|
bolabola Smarty n00b
Joined: 30 Jan 2013 Posts: 3
|
Posted: Wed Jan 30, 2013 3:08 pm Post subject: |
|
|
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 |
|
U.Tews Administrator
Joined: 22 Nov 2006 Posts: 5068 Location: Hamburg / Germany
|
Posted: Wed Jan 30, 2013 8:55 pm Post subject: |
|
|
You must do it in index.php and any other php script file which might be called to display() a page. |
|
Back to top |
|
|
|
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
|