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?
We've moved the forum!
Please use forum.silverstripe.org for any new questions
(announcement).
The forum archive will stick around, but will be read only.
You can also use our Slack channel
or StackOverflow to ask for help.
Check out our community overview for more options to contribute.
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
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.
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); } ..
OK, I will try that - it looks like a better way to go.