Jump to:

23486 Posts in 18995 Topics by 2878 members

General Questions

SilverStripe Forums » General Questions » How to use static cacheing with comments enabled

General questions about getting started with SilverStripe that don't fit in any of the categories above.

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

Page: 1
Go to End
Author Topic: 456 Views
  • inCharge
    Avatar
    Community Member
    102 Posts

    How to use static cacheing with comments enabled Link to this post

    If almost any page can have comments, then static cacheing can't be used useless there's a way to cache the comments too.

    How can a page be automatically recached when a new comment is submitted?

    In the example code here http://doc.silverstripe.org/sapphire/en/reference/staticpublisher, the subPagesToCache function checks for comments to cache the rss feed...

          // cache the RSS feed if comments are enabled
          if ($this->ProvideComments) {
             $urls[] = Director::absoluteBaseURL() . "pagecomment/rss/" . $this->ID;
          }

    ...so it looks like the author has considered the issue of comments, but there's no indication of how to show them.

    Any ideas? What about dealing with comment form submissions, spam protection mesages etc. Surely someone has already worked all this out? What about using static cacheing with the Blog module e.g. paged results, widgets etc. Has that been tried successfully, or is it not worth it & better to stick with partial cacheing?

    Thanks, Jules

  • Willr
    Avatar
    Forum Moderator
    5508 Posts

    Re: How to use static cacheing with comments enabled Link to this post

    You can statically cache pagination (by augmenting the subPagesToCache() function). You could get comments working by adding a cache rebuild trigger on an extension to Comments, onAfterWrite but for the majority of sites partial caching might be suitable effort.

    456 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.