Page 1 of 1

re-cache on comment?

PostPosted: July 27th, 2010, 2:00 pm
by dozarte
Is there a way to auto refresh a page cache when a user submits a comment?

Re: re-cache on comment?

PostPosted: July 28th, 2010, 2:49 am
by Jason Caldwell
Hi Dozarte. Thanks for the great question.

Actually, Quick Cache already handles this gracefully.

In your WP Dashboard, see: Quick Cache - Options:

Don't Cache Pages For Logged In Users?
It is best to leave this set to True at all times. Most visitors are NOT logged in, so this does not hurt performance at all. Also, this setting includes some users who AREN'T actually logged into the system, but who HAVE authored comments recently. This way comment authors will be able to see updates to the spool immediately. In other words, Quick Cache thinks of a comment author as a logged in user, even though technically they are not.

Re: re-cache on comment?

PostPosted: July 28th, 2010, 6:43 am
by dozarte
mmhh... This does not solve my problem...
On this page I can see a comment just if I'm logged in; can you see it, since you can't login?

Re: re-cache on comment?

PostPosted: July 30th, 2010, 9:37 am
by Jason Caldwell
I see the comment box, but it says " No Comments ".

If you continue to have problems, you might also want to verify that your theme is configured to display existing comments to everyone. Normally, these routines are found inside:
/wp-content/[your theme]/comments.php

Re: re-cache on comment?

PostPosted: July 30th, 2010, 10:08 am
by dozarte
Everything is ok on my theme.
Oh well... it's not a matter of life or death, so... I'm giving up!
;P
Never mind!
Thank you anyway!!

Re: re-cache on comment?

PostPosted: August 4th, 2010, 10:16 pm
by Jason Caldwell
Very welcome.
~ Sorry to hear that.

If you have a chance, please feel free to elaborate on this topic.
Maybe I didn't understand the problem exactly?

On this page I can see a comment just if I'm logged in; can you see it, since you can't login?

Re: re-cache on comment?

PostPosted: August 19th, 2010, 12:45 am
by dozarte
I simply think the plugin does not rebulit the cache of a page when a user submit a comment.
If that user can see a 'refreshed' page, other users can not.
Am I right?

Re: re-cache on comment?

PostPosted: August 24th, 2010, 9:17 am
by Jason Caldwell
I simply think the plugin does not rebulit the cache of a page when a user submit a comment.
If that user can see a 'refreshed' page, other users can not.
Am I right?

Yes, you are correct. The person who left the Comment will be able to see the updated spool ( with their comment ), and anyone else who has previously commented on your site will also see those changes immediately. s2Member does not cache pages for logged-in users. That being said, s2Member considers anyone who has commented recently, a "logged-in user", even though technically they're not.

* Note.. Quick Cache does NOT rebuild the cache each time, so public visitors who are not logged in, or have not left comments recently, will NOT see comment updates until the cache expires, which is usually an hour later. This is the intended behavior.

Re: re-cache on comment?

PostPosted: August 24th, 2010, 9:39 am
by dozarte
Thank you Jason, you were clear!

I think this could be a problem just if someone has a not often updated blog, like mine; I set up cache expires to 9999999! (my fault, I know)
I only think could be nice some 'update on comment' feature.

Anyway - as said - great plugin!

Re: re-cache on comment?

PostPosted: August 24th, 2010, 9:47 am
by Jason Caldwell
Thanks for reporting back on this. I'll add this to our TODO list for Quick Cache.

@TODO :: possible option in the back-end panel for Rebuild-On-Comment.

Re: re-cache on comment?

PostPosted: March 17th, 2011, 1:11 am
by dozarte
Jason Caldwell wrote:@TODO :: possible option in the back-end panel for Rebuild-On-Comment.


Please remember this "to do" ;)

Re: re-cache on comment?

PostPosted: March 19th, 2011, 1:43 pm
by catalyst
I found a solution but after testing with several versions of wordpress and quick cache, to me only works with wordpress 3.0.4 + Quick Cache 2.2.7, and the solution is:

add this in yout theme functions:


Code: Select all
    add_filter("comment_post_redirect", "ws_plugin__qcache_clear_on_post_page_comment", 10, 2);
    function ws_plugin__qcache_clear_on_post_page_comment($location, $comment) {
       ws_plugin__qcache_clear_on_post_page_creations_deletions($comment->comment_post_ID);
       return $location;
    }




then go to:

wp-content/plugins/quick-cache/includes/functions/clearing-routines.inc.php

and in line 32

replace with this:
Code: Select all
    if (in_array ($pagenow, ($pages = array ("edit.php", "post.php", "post-new.php", "wp-comments-post.php"))))




and you are done. again to me only works in WP 3.0.4 + QC 2.2.7

Re: re-cache on comment?

PostPosted: March 25th, 2011, 6:30 pm
by jcspain
Hi Jason,

"Re-cache on comment" is the only thing I miss in this plugin. I want to set a high value in "Cache expires" because once published a post, rarely changes, so rebuilding it's not necessary. But if I set this high value, appears the same problem described by dozarte: users not logged in can't see new messages until the end of the "Cache expires" period. Please consider implementing this feature in next version.

Thank you!

Re: re-cache on comment?

PostPosted: March 26th, 2011, 1:08 am
by dozarte
I'm happy I'm not alone ;)

Re: re-cache on comment?

PostPosted: March 26th, 2011, 4:28 pm
by fozzzo
Hi, I've just registered to say that I would also like to see this option, i.e. "Re-cache on comment". For me it looks better if comments are considered as page update, i.e. that page's cache is reset and rebuilt for only that page/post (like when you update the page/post).

If we have this option I would set cache to much higher value, at the moment I cannot do that, because I am getting comments occasionally and current settings wouldn't be friendly for the post that is getting comments. And the truth is, if your site has 50 pages for example, you are getting comments on very few... and all other pages suffer in speed since you cannot set higher cache value because of these few posts.

I'm aware that those posts can be dismissed with Quick cache options, but those are posts with most traffic and would be nice to have them cached. I am actually getting just a couple of comments daily and automatic re-caching would work perfectly for me.

The other solution could be different caching for posts and pages.

Btw, big thank you for the plugin, I like it more than other cache options for WP.

Re: re-cache on comment?

PostPosted: April 15th, 2011, 3:00 am
by ovidiu
I second this request.
I would very much like a page's cache to be cleared after a comment is submitted.

Re: re-cache on comment?

PostPosted: April 19th, 2011, 4:20 am
by Paul030
Agreed - this would make this caching plugin perfect. You could essentially cache for weeks if comments invalidated the cache for individual posts.

Is it that hard to add this feature?

Has anyone patched the plugin to provide this feature? Or is an update in the works?