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
+6
View File
@@ -1159,6 +1159,12 @@ function populate_network_meta( $network_id, array $meta = array() ) {
}
}
if ( function_exists( 'clean_network_cache' ) ) {
clean_network_cache( $network_id );
} else {
wp_cache_delete( $network_id, 'networks' );
}
wp_cache_delete( 'networks_have_paths', 'site-options' );
if ( ! is_multisite() ) {