[wp-trac] [WordPress Trac] #59516: Improve cache key generation in the WP_Query class

WordPress Trac noreply at wordpress.org
Tue Jan 28 22:50:33 UTC 2025


#59516: Improve cache key generation in the WP_Query class
-----------------------------------------------+--------------------------
 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):

 In the linked pull request, I've:

 * normalized array values for items managed by `WP_Query`, they are:
    - type cast to `int` where appropriate
    - duplicate value removed
    - sorted
 * ignored items managed in other classes:
    - meta_query
    - term_query
 * created a property for the cache key to allow for testing the generated
 value
 * accounted for array values that can be used in orderby
 * added a number of tests but more suggestions are welcome

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/59516#comment:37>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list