Opened 9 years ago
Last modified 5 months ago
#35430 new enhancement
Should the 'counts' cache group be persistent?
Reported by: | wjywbs | Owned by: | |
---|---|---|---|
Milestone: | Future Release | Priority: | normal |
Severity: | normal | Version: | 4.4 |
Component: | Cache API | Keywords: | has-patch has-unit-tests |
Focuses: | performance | Cc: |
Description
I checked that the places storing data in the 'counts'
cache group have proper way to delete the data in cache on updates. For example, wp_count_posts()
stores the post count, and _transition_post_status()
deletes the count. So could we change the 'counts'
cache group to be persistent? This can reduce the repeated counting queries to the database.
Attachments (1)
Change History (13)
#3
@
8 years ago
- Keywords needs-unit-tests added
I would like to see some unit tests to support this change. Here is a draft for the make post for when that is ready.
## Persistent count caching in 4.8
The counts
cache group has historically been excluded since [7986] fixed #6740. In the last 8 years, changes have made this no longer necessary. As such, counts
is no longer a non-persistent group as of #XXXX. This should enable sites using a persistent cache to reduce the number of queries on certain page loads.
If you are are using the counts
cache group in your code or are running a site with a persistant cache, you are highly encouraged to test this change.
This ticket was mentioned in Slack in #core by chriscct7. View the logs.
8 years ago
#6
@
7 years ago
Whats the matter with this?
I removed counts
from the non-persistent groups on all of my sites and never encountered an issue with that.
There are many plugins that would gain performance.
#8
@
2 years ago
- Keywords needs-refresh added
Hi there!
There is no movement on this for a long time and the persistent_counts.diff patch need update with the latest version.
The comment caches were set persistent in #36906.
#9
@
2 years ago
Some important notes on why the group is currently non-persistent in ticket:47884:8.
This ticket was mentioned in PR #3748 on WordPress/wordpress-develop by @dd32.
22 months ago
#10
- Keywords has-patch has-unit-tests added; needs-unit-tests needs-refresh removed
Trac ticket: https://core.trac.wordpress.org/ticket/35430
22 months ago
#11
For counts that are moved to persistent caches, some unit tests would be dandy to ensure that the cache clears as expected.
There's some existing tests that cover some of these, which is the purpose of the myriad of clean_comment_cache()
calls that were added to clean comment caches (The existing unit tests failed after the change).
I agree though, that additional unit tests are needed.
This ticket was mentioned in PR #6509 on WordPress/wordpress-develop by @pbearne.
5 months ago
#12
Refresh
Let's look