update_site_cache()WP 4.6.0

Updates sites in cache.

Хуков нет.

Возвращает

null. Ничего (null).

Использование

update_site_cache( $sites, $update_meta_cache );
$sites(массив) (обязательный)
Array of site objects.
$update_meta_cache(true|false)
Whether to update site meta cache.
По умолчанию: true

Список изменений

С версии 4.6.0 Введена.
С версии 5.1.0 Introduced the $update_meta_cache parameter.

Код update_site_cache() WP 6.5.2

function update_site_cache( $sites, $update_meta_cache = true ) {
	if ( ! $sites ) {
		return;
	}
	$site_ids          = array();
	$site_data         = array();
	$blog_details_data = array();
	foreach ( $sites as $site ) {
		$site_ids[]                                    = $site->blog_id;
		$site_data[ $site->blog_id ]                   = $site;
		$blog_details_data[ $site->blog_id . 'short' ] = $site;

	}
	wp_cache_add_multiple( $site_data, 'sites' );
	wp_cache_add_multiple( $blog_details_data, 'blog-details' );

	if ( $update_meta_cache ) {
		update_sitemeta_cache( $site_ids );
	}
}