Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We're retiring the forums!

The SilverStripe forums have passed their heyday. They'll stick around, but will be read only. We'd encourage you to get involved in the community via the following channels instead:

Forum Module /

Discuss the Forum Module.

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

Forum caching


Go to End


5 Posts   2402 Views

Avatar
Ishmael

Community Member, 3 Posts

5 February 2009 at 7:27pm

Edited: 05/02/2009 7:27pm

I am running SilverStripe 2.2.3 with the forum module. I would like to know how to prevent the forum from caching as heavily as it does. Whenever I go to a forum page it always displays the old topics until I refresh the page. This happens in every browser. Is it simply a question of checking the "Refresh this forum" box in the admin area? What does that do?

Avatar
Willr

Forum Moderator, 5523 Posts

9 February 2009 at 10:23am

Refresh this forum is an old feature (which I think have been stripped out but admin field is there still), this used to refresh the forum via AJAX every 30secs/ 1min etc.

One way you can stop SilverStripe from caching is to put this in your mysite/_config.php file HTTP::set_cache_age(0);. Or if you just want the forum holder view to not cache just try put that in forum/code/ForumHolder.php inside the

function init() {
// put it here
...
}

And see if that makes a difference

Avatar
Ishmael

Community Member, 3 Posts

9 February 2009 at 10:46am

Thanks, Will. Is it possible to just set

HTTP::set_cache_age 
in /forum/_config.php instead of changing the core SilverStripe code? The forum is the only place that I am having trouble with caching, so I don't want to set it at site level.

Avatar
Willr

Forum Moderator, 5523 Posts

9 February 2009 at 10:54am

I think even if you put it in forum/_config.php it will still include it site wide. You could try (it the set_cache_age works) in your own Page.php file - in the function init() { if($this->ClassName == 'ForumHolder') { HTTP::set_cache_age(0); } ..

Avatar
Ishmael

Community Member, 3 Posts

9 February 2009 at 10:55am

OK, I will try that - it looks like a better way to go.