I've noticed that wpDiscuz clears ALL WP Rocket cache when voting on comments and posts. However it should ONLY clear the cache for the current post.
There is two functions that exist in wpDiscuz for clearing cache: function cleanAllCaches() and cleanPostCache(). It seems like the wrong function is called when voting on a post or comment. The correct one would be cleanPostCache, but all of the WP Rocket cache gets cleared by wpDiscuz each time someone vote on a comment or post.
Obviously that makes the caching solution to re-cache everything unneccesary and quite often in this case. Could you please look into this and fix it?
I've tested thoroughly with WP Rocket support on this and have disabled all programmatically clearing of cache in WP Rocket, but still wpDiscuz seems to be calling the wrong function cleanAllCaches.
Hi,
The cleanAllCaches() function is exclusively used when wpDiscuz is being updated. It's important to note that a different function (the post's cache cleaning function) calls when a comment or post is being voted on, initiating the removal of post caches.
That is what should happen. However a full cache clearing is called when wpDiscus register a vote. Could you please test this?
Thanks for the feedback. Still, in production at our magazine, when a post or comment is rated, WP Rocket creates a whole new cache for the site. It can be observed by watching the 3 posts in a black row change, just below the main post on the frontpage:
https://www.nyhetsspeilet.no/
I really don't know how this can happen if it is really clean_post that is called. Any help is appreciated.
Yes, I've already done that and installed a debug plugin from WP Rocket to programmatically disable WP Rockets own "clear cache"-functions so that it is only other plugins or the theme that can trigger clear cache.
Strangely the global cache still gets cleared immediately after voting on comments/posts. Every single time consistently.
As you seem 100% certain that the problem is not wpDiscuz, I have asked WP Rocket support to trace the problem further.
WP Rocket support just informed me that the home page cache also gets refreshed as a related content when voting. So it is an unexpected function per design that is only the page and frontpage, not the whole cache. Case closed.