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.

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


git-svn-id: http://core.svn.wordpress.org/trunk@45721 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Felix Arntz
2019-08-29 12:42:56 +00:00
parent ccdc221b32
commit 90c424f73b
5 changed files with 24 additions and 10 deletions

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() ) {