Networks and Sites: Improve cache key generation in WP_Site_Query class.

Improve cache key generation in the `WP_Site_Query` class by removing `update_site_cache` and `update_site_meta_cache` elements in the array used to generate 
the cache key.  These elements do not affect that cache and by removing them, improve the likelihood of reusing an existing cache. 

Props Spacedmonkey, furi3r, johnbillion, johnjamesjacoby, flixos90.
Fixes #55462.


Built from https://develop.svn.wordpress.org/trunk@53097


git-svn-id: http://core.svn.wordpress.org/trunk@52686 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
spacedmonkey 2022-04-07 17:46:04 +00:00
parent 337e4a8d90
commit 7aad7bef06
2 changed files with 3 additions and 3 deletions

View File

@ -345,8 +345,8 @@ class WP_Site_Query {
// $args can include anything. Only use the args defined in the query_var_defaults to compute the key.
$_args = wp_array_slice_assoc( $this->query_vars, array_keys( $this->query_var_defaults ) );
// Ignore the $fields argument as the queried result will be the same regardless.
unset( $_args['fields'] );
// Ignore the $fields, $update_site_cache, $update_site_meta_cache argument as the queried result will be the same regardless.
unset( $_args['fields'], $_args['update_site_cache'], $_args['update_site_meta_cache'] );
$key = md5( serialize( $_args ) );
$last_changed = wp_cache_get_last_changed( 'sites' );

View File

@ -16,7 +16,7 @@
*
* @global string $wp_version
*/
$wp_version = '6.0-alpha-53096';
$wp_version = '6.0-alpha-53097';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.