Im running a rather large wpmu setup bloggersdelight.dk - from time to time, we need to reset the object cache when doing changes on the site. When we do this, things mess up. Option values from sites gets mixed together and homeurls for blogs redirects to wrong blogs etc.
This is the current object-cache.php im working with.
As you can se the flush function is created in a way that it does not allow to flush if multisite. This was the default for the plugin found on wordpress.org. In order to flush a blogs cache i need to do some "fun" created stuff like this:
switch_to_blog($blogid);
$pattern = "/^" . $blogid . ":/";
$memcache = new Memcache();
$memcache->connect( $server, $port );
$list = array();
$allSlabs = $memcache->getExtendedStats( 'slabs' );
$items = $memcache->getExtendedStats( 'items' );
foreach ( $allSlabs as $server => $slabs ) {
foreach( $slabs as $slabId => $slabMeta ) {
if ( !empty( $slabId ) ) {
$cdump = $memcache->getExtendedStats( 'cachedump', (int) $slabId );
foreach( $cdump as $keys => $arrVal ) {
if ( !is_array( $arrVal ) ) continue;
foreach( $arrVal as $k => $v ) {
if(preg_match($pattern, $k))
{
$list[] = $k;
# $memcache->delete($k);
$parts = explode(":",$k);
print_r($parts);
wp_cache_delete($parts[2],$parts[1]);
}
}
}
}
}
}
return $list;
This seems to work for a single blog, allthough some items do not get cleared.
Anyways, the problems occour when i do this
telnet localhost 11211 and then type flush_all
then things get weird and option values get mixed between blogs. If i run the flush_all command multiplte times then the problem usually is reducd and less blogs gets wrong option values.
Does anyone have any suggestion to how to solve this ?
Do i need to create some kind of key SALT ?