mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-07-01 15:50:09 +00:00
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. git-svn-id: https://develop.svn.wordpress.org/trunk@53097 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -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' );
|
||||
|
||||
Reference in New Issue
Block a user