[wp-trac] [WordPress Trac] #59516: Improve cache key generation in query classes
WordPress Trac
noreply at wordpress.org
Mon Oct 2 13:35:14 UTC 2023
#59516: Improve cache key generation in query classes
--------------------------+----------------------------
Reporter: spacedmonkey | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Future Release
Component: Query | Version:
Severity: normal | Keywords:
Focuses: performance |
--------------------------+----------------------------
In query classes such as WP_Query, parameters like post_type enable the
passing of an array of values. For instance, you can use post_type like
this: ['post', 'page']. However, if a subsequent request is made with the
array elements in a different order, like so: ['page', 'post'], it would
lead to the generation of a different cache key, potentially causing the
existing cache to be missed. Even though the cached results may be the
same, this could result in a cache collision. It is advisable to reuse
caches whenever possible to optimize performance.
This would effect the following cache keys.
- WP_Query
- WP_Term_Query
- WP_Network_Query
- WP_Site_Query
- WP_Comment_Query
Some sort of array sorting of the key values would mean that caches could
be reused.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/59516>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list