Skip to content

Instantly share code, notes, and snippets.

@weskoop
Created November 13, 2012 01:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save weskoop/4063297 to your computer and use it in GitHub Desktop.
Save weskoop/4063297 to your computer and use it in GitHub Desktop.
New flush() for APC object Cache - accounts for multiple sites on using one cache.
function flush() {
// Don't flush if multi-blog.
if ( function_exists( 'is_site_admin' ) || defined( 'CUSTOM_USER_TABLE' ) && defined( 'CUSTOM_USER_META_TABLE' ) )
return true;
$user_cache = apc_cache_info( 'user' );
foreach( $user_cache['cache_list'] as $cache_entry ) {
if ( false !== strstr( $cache_entry['info'], WP_APC_KEY_SALT . ':' . $this->abspath ) )
apc_delete( $cache_entry['info'] );
}
return true;
// return apc_clear_cache( 'user' );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment