Multisite: Improve performance by caching not found lookups for sites and networks.

With this change, the result of a site or network lookup by ID will be cached even if the ID does not exist. When a new site or network is created, the cache for the respective new ID is cleared.

Props mnelson4, nielsdeblaauw.
Fixes #42251.


git-svn-id: https://develop.svn.wordpress.org/trunk@45910 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Felix Arntz
2019-08-29 12:41:45 +00:00
parent 65f3124283
commit 4572bb0988
6 changed files with 111 additions and 9 deletions
+2 -2
View File
@@ -69,14 +69,14 @@ function wp_insert_site( array $data ) {
return new WP_Error( 'db_insert_error', __( 'Could not insert site into the database.' ), $wpdb->last_error );
}
clean_blog_cache( $wpdb->insert_id );
$new_site = get_site( $wpdb->insert_id );
if ( ! $new_site ) {
return new WP_Error( 'get_site_error', __( 'Could not retrieve site data.' ) );
}
clean_blog_cache( $new_site );
/**
* Fires once a site has been inserted into the database.
*