Suggestion: Needs smarter comment logic to prevent wasteful cache clearing
-
First off, thanks for this great plugin. It’s lightweight and does the job well.
However, its comment clearing logic can be improved. The following are problems I see with several other caching plugins.
1: Problem: When a user comments, the plugin doesn’t exclude that user from seeing the cache. Therefore, they don’t see text that their comment is awaiting moderation.
Solution: When a user posts a comment, exclude them from seeing the cache. Better yet, have an option within the admin area to exclude such users. Just check for the existence of the proper WordPress comment cookie.
2: Problem: Comments that are NOT marked as “approved” will still clear the cache upon modification. The page-specific cache will clear if any of the following happens:
– Pending/unapproved comment is deleted, marked as spam, or edited
– Trashed comment is restored, marked as spam, or deleted permanently
– Spam comment is marked as not spam, or deleted permanentlySolution: Only clear the page-specific cache if it materially impacts the page.
– Modifying a comment whose status is NOT currently approved should never clear the cache.
– Modifying a comment whose status changes from not approved to approved should clear the cache.
– Modifying a comment whose status changes from approved to anything else should clear the cache.I’ve seen this sort of blind spot in many caching plugins. Only a few I’ve come across have put in real logic to properly prevent the cache from unnecessarily clearing by checking the comment status.
Think of an admin pruning pending moderation comments by marking them as spam or deleting them outright will clear the page cache every time, even when those comments aren’t even appearing on the page.
Please implement this logic and this great plugin will be brought up several notches. I’m ready to drop my existing caching plugin for Cache Enabler, but I’m awaiting this implementation first. Otherwise, comment administration is going to be a problem.
Note: The plugin doesn’t clear the cache when a new comment is posted and held in moderation (which is great), so it seems that this sort of check is put in place at the outset, but it should be in place during the entire lifecycle of a comment.
Thanks.
- The topic ‘Suggestion: Needs smarter comment logic to prevent wasteful cache clearing’ is closed to new replies.