bp_blogs_clear_blog_object_cache

Clear the blog object cache.

Description

bp_blogs_clear_blog_object_cache( (int) $blog_id = 0, (int) $user_id = 0 ); 

Parameters (2)

0. $blog_id — Optional. (int)
ID of the current blog.
1. $user_id — Optional. (int)
ID of the user whose blog cache should be cleared.

Usage

  1. if ( !function_exists( 'bp_blogs_clear_blog_object_cache' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'buddypress/bp-blogs/bp-blogs-cache.php'; 
  3.  
  4. // ID of the current blog. 
  5. $blog_id = -1; 
  6.  
  7. // ID of the user whose blog cache should be cleared. 
  8. $user_id = -1; 
  9.  
  10. // NOTICE! Understand what this does before running. 
  11. $result = bp_blogs_clear_blog_object_cache($blog_id, $user_id); 
  12.  

Defined (1)

The function is defined in the following location(s).

/bp-blogs/bp-blogs-cache.php  
  1. function bp_blogs_clear_blog_object_cache( $blog_id = 0, $user_id = 0 ) { 
  2. if ( ! empty( $user_id ) ) { 
  3. wp_cache_delete( 'bp_blogs_of_user_' . $user_id, 'bp' ); 
  4. wp_cache_delete( 'bp_total_blogs_for_user_' . $user_id, 'bp' ); 
  5.  
  6. wp_cache_delete( 'bp_total_blogs', 'bp' );