清除博客缓存
描述
清理博客的缓存对象。
用法
<?php clean_blog_cache( $blog ); ?>
参数
$blog
(Object) (必填) 从 get_blog_details() 返回的博客详细信息
默认值: None
历史
添加于 版本 3.5.0
源文件
clean_blog_cache() 函数的代码位于 wp-includes/ms-blogs.php
.
/**
* Clean the blog cache
*
* @since 3.5.0
*
* @param stdClass $blog The blog details as returned from get_blog_details()
*/
function clean_blog_cache( $blog ) {
$blog_id = $blog->blog_id;
$domain_path_key = md5( $blog->domain . $blog->path );
wp_cache_delete( $blog_id , ‘blog-details’ );
wp_cache_delete( $blog_id . ‘short’ , ‘blog-details’ );
wp_cache_delete( $domain_path_key, ‘blog-lookup’ );
wp_cache_delete( ‘current_blog_’ . $blog->domain, ‘site-options’ );
wp_cache_delete( ‘current_blog_’ . $blog->domain . $blog->path, ‘site-options’ );
wp_cache_delete( ‘get_id_from_blogname_’ . trim( $blog->path, ‘/’ ), ‘blog-details’ );
wp_cache_delete( $domain_path_key, ‘blog-id-cache’ );
}