wpDiscuz clears ALL...
 
Share:
Notifications
Clear all

[Solved] wpDiscuz clears ALL WP Rocket cache when voting on comments and posts

8 Posts
2 Users
1 Likes
195 Views
Posts: 19
Topic starter
(@itpro)
Eminent Member
Joined: 1 year ago

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.

7 Replies
Asti
Posts: 6987
 Asti
Support
(@asti)
Illustrious Member
Joined: 6 years ago

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.

Posts: 19
Topic starter
(@itpro)
Eminent Member
Joined: 1 year ago

That is what should happen. However a full cache clearing is called when wpDiscus register a vote. Could you please test this?

1 Reply
Asti
 Asti
Support
(@asti)
Joined: 6 years ago

Illustrious Member
Posts: 6987

@itpro,

The developers have rechecked it. Please find their response below:

The wpDiscuz plugin utilizes the rocket_clean_post() function and passes the post_id to it. To clear all caches, Rocket uses the rocket_clean_domain() function.

So, again, when a comment or post is voted on, the rocket_clean_post() function is invoked.

 

Posts: 19
Topic starter
(@itpro)
Eminent Member
Joined: 1 year ago

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/


em66a17b92-479b-4509-aecb-bc1918f23c69@59a79797.com


I really don't know how this can happen if it is really clean_post that is called. Any help is appreciated.

1 Reply
Asti
 Asti
Support
(@asti)
Joined: 6 years ago

Illustrious Member
Posts: 6987

@itpro,

If you contact WP Rocket plugin support, they may better guide you towards a solution.

We have already pointed out the functions that wpDiscuz uses in this case.

Posts: 19
Topic starter
(@itpro)
Eminent Member
Joined: 1 year ago

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.

Posts: 19
Topic starter
(@itpro)
Eminent Member
Joined: 1 year ago

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.

Share: