[wp-trac] [WordPress Trac] #59516: Improve cache key generation in query classes
WordPress Trac
noreply at wordpress.org
Wed Jan 22 01:59:08 UTC 2025
#59516: Improve cache key generation in query classes
-----------------------------------------------+--------------------------
Reporter: spacedmonkey | Owner: pbearne
Type: defect (bug) | Status: accepted
Priority: normal | Milestone: 6.8
Component: Query | Version:
Severity: normal | Resolution:
Keywords: has-patch changes-requested early | Focuses: performance
-----------------------------------------------+--------------------------
Comment (by peterwilsoncc):
I've marked the pull request as ready for review.
For arguments that can be passed as an array, it sorts them where
possible.
For `*__in` arguments that can be used for the orderby clause, it sorts
the value for the purpose of generating the WHERE clause but not the
ORDERBY clause.
In cases where the code base takes a different path depending on whether
the argument is passed as an array or string, I've sorted the array
version but have not converted the string to an array. This mainly effects
the post type and status as they have some ''interesting'' code that I
would rather not mess with.
The generated cache key is now stored as a private property on `WP_Query`
to allow for unit tests to compare the generated keys after normalization.
Otherwise the method would need to normalize the data exclusively for the
purpose of the unit tests.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/59516#comment:30>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list