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.

Forum Module /

Discuss the Forum Module.

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

Forum caching


Reply


5 Posts   1947 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, 5513 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, 5513 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.