[wp-trac] [WordPress Trac] #59592: Store last changed value in key instead of using it as a salt for query caches

WordPress Trac noreply at wordpress.org
Fri May 23 06:50:50 UTC 2025


#59592: Store last changed value in key instead of using it as a salt for query
caches
--------------------------------------+-----------------------------
 Reporter:  spacedmonkey              |       Owner:  (none)
     Type:  enhancement               |      Status:  new
 Priority:  normal                    |   Milestone:  Future Release
Component:  Cache API                 |     Version:
 Severity:  normal                    |  Resolution:
 Keywords:  has-patch has-unit-tests  |     Focuses:  performance
--------------------------------------+-----------------------------

Comment (by spacedmonkey):

 How about the following functions.

 {{{#!php
 function wp_query_cache_get( $cache_key, $group, $last_changed )
 }}}

 {{{#!php
 function wp_query_cache_set( $cache_key, $data, $group, $last_changed ){
 wp_cache_set( $key, [ 'data' => $data, 'last_chagned' => $last_changed ],
 $group)
 }
 }}}

 I also consider `wp_cache_get_query_data` and `wp_cache_set_query_data`
 for the naming. Thoughts @peterwilsoncc @flixos90 ?


 I want to avoid doing another `wp_cache_get_last_changed`, as this might
 result in a remote cache get ( like in the case of @rmccue ). That is why
 I am passing `$last_changed` into the function instead of passing
 `$cache_group`.

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


More information about the wp-trac mailing list