04 October 2006

Qgyen.ClearCommentCache

Recently, I had an idea for a new CSModule that would make it so that comments to blog posts would show up immediately after being posted, instead of having to wait for the cache to be cleared.  As such, my new ClearCommentCache module was born.

This module does not prevent the caching of comments in any way.  It simply waits for a new comment or trackback to made, and after it is submitted, it will clear the current cache of modules, so that on the next request, it will go to the database and get a fresh list.

A few other little things it does includes:

  • Will only clear the cache when the comment passes spam filters
  • Will allow you to configure it to clear the cache across all posts, or only certain posts
  • Use a [ ClearCommentCache ] text part (no spaces around the [ ]) will cause the cache to be cleared on new comments for that particular post.  It will also strip the text part from the message so it doesn't show.

Yes, the module is being used on this post (though only this post, not across my whole site).

Download (Requires Community Server v2.1)

Posted 7:17 pm | Archive

Comments

Dave Burke on 10/04/2006 at 10:08 pm

More Qgyenification for dbvt.com!  Installed and working great!  Thanks for creating this CSModule, Ken.  

Don't forget that people are also going to have to change their Success Message, removing "it may not appear right away due to caching." :-)

on 10/04/2006 at 10:38 pm

Yeah, but that is more involved than dropping in a module and adding a module entry.  :)

Rory Primrose on 10/04/2006 at 11:29 pm

Sounds great Ken. Can the same be done for blog posts?

on 10/05/2006 at 12:01 am

Yeah, you could change the code to do that.

jayson knight on 10/05/2006 at 5:04 am

Testing this sucker out.

Good idea btw.

James Shaw on 10/05/2006 at 6:30 am

Kinda sad that this change wasn't made to the core though - this is a case where caching really gets in the way of the user having a good experience. Caches should be flushed by the app when the underlynig data is modified...oh well..

on 10/05/2006 at 10:45 am

A cache/memory overhaul is needed in CS, and will more than likely be coming with like 3.1.  If nothing else, I'll just dive in and do it myself. :)

Dennis van der Stelt on 10/06/2006 at 3:06 pm

Also when flushing the cache on posting a new post, will make Windows Live Writer work better on detecting style! :)

I'd LOVE that feature in this plugin!

R on 10/12/2006 at 10:53 am

Does this work even with the forums? I noticed that posts to my forums take a while to appear.

on 10/12/2006 at 1:03 pm

No, it is not for the forums, it is only for the blogs.