[wp-trac] [WordPress Trac] #55352: Improve cache key generation in WP_Term_Query

WordPress Trac noreply at wordpress.org
Tue Apr 19 10:51:21 UTC 2022


#55352: Improve cache key generation in WP_Term_Query
--------------------------------------+---------------------------
 Reporter:  spacedmonkey              |       Owner:  spacedmonkey
     Type:  enhancement               |      Status:  closed
 Priority:  normal                    |   Milestone:  6.0
Component:  Taxonomy                  |     Version:  4.7
 Severity:  normal                    |  Resolution:  fixed
 Keywords:  has-patch has-unit-tests  |     Focuses:  performance
--------------------------------------+---------------------------

Comment (by spacedmonkey):

 I did some more testing, I noticed, I was getting duplicate queries in the
 admin.

 This was fix by changing this line to

 {{{#!php
 $key          = md5( serialize( $cache_args ) . serialize( $taxonomies ) .
 $this->request );

 }}}

 to
 {{{#!php
 $key          = md5( serialize( asort( $cache_args ) ) . serialize(
 $taxonomies ) . $this->request );

 }}}

 Seems like a small different in the cache args, can result in an new cache
 key.

 I know @peterwilsoncc had a flagged something similar. As this is a small
 change, I think that can made it into 6.0

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


More information about the wp-trac mailing list