Created
November 13, 2012 01:30
-
-
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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