Make WordPress Core


Ignore:
Timestamp:
04/07/2022 05:44:34 PM (3 years ago)
Author:
spacedmonkey
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/class-wp-site-query.php

    r52977 r53097  
    346346        $_args = wp_array_slice_assoc( $this->query_vars, array_keys( $this->query_var_defaults ) );
    347347
    348         // Ignore the $fields argument as the queried result will be the same regardless.
    349         unset( $_args['fields'] );
     348        // Ignore the $fields, $update_site_cache, $update_site_meta_cache argument as the queried result will be the same regardless.
     349        unset( $_args['fields'], $_args['update_site_cache'], $_args['update_site_meta_cache'] );
    350350
    351351        $key          = md5( serialize( $_args ) );
Note: See TracChangeset for help on using the changeset viewer.