Make WordPress Core

Opened 6 years ago

Last modified 4 months ago

#35430 new enhancement

Should the 'counts' cache group be persistent?

Reported by: wjywbs's profile wjywbs Owned by:
Milestone: Future Release Priority: normal
Severity: normal Version: 4.4
Component: Cache API Keywords: needs-unit-tests
Focuses: performance Cc:


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)

persistent_counts.diff (682 bytes) - added by wjywbs 6 years ago.

Download all attachments as: .zip

Change History (8)

#1 @wonderboymusic
6 years ago

  • Milestone changed from Awaiting Review to 4.7

Let's look

#2 @jorbin
6 years ago

This needs a dev post when it goes in.

#3 @jorbin
6 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.

6 years ago

#5 @chriscct7
6 years ago

  • Keywords 4.8-early added
  • Milestone changed from 4.7 to Future Release

#6 @fabifott
5 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.

#7 @johnbillion
4 months ago

  • Keywords 4.8-early removed
Note: See TracTickets for help on using tickets.