WP-Cache Not Clearing When Comments Are Posted! Anyone Else Experiencing This?

I have struggled with this for so long now, and I cannot for the life of me figure out what the problem is. So I turn to you, dear reader. In order to take off some of the load on my database server, I’m using the excellent WP-Cache plugin. The plugin automatically writes static HTML files to the server, serving these to visitors instead of asking the database for a fresh copy every time. The cache is supposed to be purged whenever someone posts a comment.

Except, this doesn’t work for me. I have scoured the web, including the WordPress forums. People seem to have all sorts of problems, some have even created plugins to purge the cache when the admin loads. Am I missing something? Isn’t WP-Cache supposed to purge the static files when content is updated? And if not, shouldn’t there at least be an option to tell it to do so?

6 thoughts on “WP-Cache Not Clearing When Comments Are Posted! Anyone Else Experiencing This?”

  1. Maybe php/apache/whatever fuels the cache-plugin, doesn’t have the proper file permissions?

  2. Brendan says:

    .. wp-cache has some fundamental issues with some of the dynamic content generated by WP. I’ve found it actually slows down over time, as the cache fills and, to be blunt, once one starts using javascript, ajax, etc the benefits become less useful due to the ‘single-instance’ nature of some script code.

    There are still db hits every time a page is hit as various settings are stored in the db, iirc.

    I’ve used it on and off for some time now and whenever I turned it on, it always seemed to cause issues, including, but not limited to randomly serving ‘blank’ 0byte pages, randomly stopping comments appearing (or being recorded, at all) sluggish performance (serving dynamic content often ended up faster) and general misbehaviour.

    The same kinds of problems are why the wp internal cache was disabled.

    I noticed a slight reduction in problems if I set the timeout to

  3. Joen says:

    Maybe php/apache/whatever fuels the cache-plugin, doesn?t have the proper file permissions?

    Hmm.. can you elaborate?

    .. wp-cache has some fundamental issues with some of the dynamic content generated by WP.

    Very much so. I’m getting more and more bummed about WP Cache, especially since Staticize Reloaded worked just fine. Maybe I should try and go back to that.

    On another note, I just recently discovered documentation on WP Cache. There’s supposed to be a “Flush Cache” function call. If that function actually works, it should be relatively easy for me to write an addon plugin that hooks up with comment_post and then calls that function.

    Bottomline, I’ll soon be able to test whether it’s the “Flush Cache” function call that doesn’t work, or if it’s some other part of WP-Cache.

  4. Jonas Rabbe says:

    The WP Cache plug-in already uses the comment_post hook to test if the comment was approved, so it doesn’t flush the cache if the comment goes into the moderation queue, and flushes the cache for the relevant post if that is the case. Now, something might be borked with that test under some conditions, but I haven’t look enough at the code to say anything about that.

    If staticize reloaded does what you need, then I don’t see any reason not to use it. All the extra functionality WP Cache includes also makes it more probable that there are bugs. As far as I remember staticize reloaded was the simplest possible cache implementation.

  5. Joen says:

    Now, something might be borked with that test under some conditions, but I haven?t look enough at the code to say anything about that.

    At least I now have confirmation that it is supposed to clear the cache on comment post. It doesn’t do that in any of my test cases. Thanks.

    If staticize reloaded does what you need, then I don?t see any reason not to use it.

    I may have to do that. I will miss the exclude pages feature though.

  6. Joen says:

    Having tested for a few days now, It seems things are starting to work. I have no idea what made it work, but I have aggressive caching enabled now, yet the comment shows up as it’s supposed to.

    It still doesn’t work on my Fauna blog, so the question “what made it work” is still out in the open.

Comments are closed.