clean_blog_cache()
clean_blog_cache( WP_Site|int $blog )
清除博客缓存
Clean the blog cache
参数(Parameters)
参数 | 类型 | 必填 | 说明 |
---|---|---|---|
$blog | (WP_Site | int) | 必需 | 要从缓存中清除的站点对象或ID。 |
返回(Return)
无返回值
源码(Source)
/** * 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' ); }
更新版本 | 源码位置 | 使用 | 被使用 |
---|---|---|---|
3.5.0 | wp-includes/ms-site.php:972 | 7 | 8 |
clean_blog_cache() 为WP2原创文章,链接:https://www.wp2.cn/functions/clean_blog_cache/