[wp-trac] [WordPress Trac] #15548: Cache inconsistencies between get_option and get_blog_option
WordPress Trac
wp-trac at lists.automattic.com
Tue Nov 23 08:56:18 UTC 2010
#15548: Cache inconsistencies between get_option and get_blog_option
--------------------------+-------------------------------------------------
Reporter: mwidmann | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Multisite | Version: 3.0.1
Severity: normal | Keywords: caching, memcache
--------------------------+-------------------------------------------------
Comment(by mwidmann):
Here's a way around this limitation, I load it from a mu-plugin.
{{{
add_action( 'update_option', 'vmh_update_option', 11, 3 );
add_action( 'delete_option', 'vmh_delete_option', 11, 2 );
function vmh_update_option( $option, $oldvalue, $newvalue ) {
global $blog_id;
if ( is_multisite() ) {
$key = $blog_id."-".$option."-blog_option";
$value = wp_cache_get( $key, "site-options" );
if ( FALSE !== $value ) {
wp_cache_set( $key, $newvalue, "site-options" );
}
}
}
function vmh_delete_option( $option, $oldvalue ) {
global $blog_id;
if ( is_multisite() ) {
$key = $blog_id."-".$option."-blog_option";
wp_cache_delete( $key, "site-options" );
}
}
}}}
--
Ticket URL: <http://core.trac.wordpress.org/ticket/15548#comment:1>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list