Index: wp-includes/load.php
===================================================================
--- wp-includes/load.php	(revision 21393)
+++ wp-includes/load.php	(working copy)
@@ -381,7 +381,7 @@
  * @since 3.0.0
  */
 function wp_start_object_cache() {
-	global $_wp_using_ext_object_cache;
+	global $_wp_using_ext_object_cache, $blog_id;
 
 	$first_init = false;
  	if ( ! function_exists( 'wp_cache_init' ) ) {
@@ -403,8 +403,8 @@
 	// If cache supports reset, reset instead of init if already initialized.
 	// Reset signals to the cache that global IDs have changed and it may need to update keys
 	// and cleanup caches.
-	if ( !$first_init && function_exists('wp_cache_reset') )
-		wp_cache_reset();
+	if ( ! $first_init && function_exists( 'wp_cache_switch_to_blog' ) )
+		wp_cache_switch_to_blog( $blog_id );
 	else
 		wp_cache_init();
 
Index: wp-includes/ms-blogs.php
===================================================================
--- wp-includes/ms-blogs.php	(revision 21393)
+++ wp-includes/ms-blogs.php	(working copy)
@@ -487,18 +487,22 @@
 			$current_user->for_blog( $blog_id );
 	}
 
-	if ( is_object( $wp_object_cache ) && isset( $wp_object_cache->global_groups ) )
-		$global_groups = $wp_object_cache->global_groups;
-	else
-		$global_groups = false;
-
-	wp_cache_init();
-	if ( function_exists('wp_cache_add_global_groups') ) {
-		if ( is_array( $global_groups ) )
-			wp_cache_add_global_groups( $global_groups );
+	if ( function_exists( 'wp_cache_switch_to_blog' ) ) {
+		wp_cache_switch_to_blog( $blog_id );
+	} else {
+		if ( is_object( $wp_object_cache ) && isset( $wp_object_cache->global_groups ) )
+			$global_groups = $wp_object_cache->global_groups;
 		else
-			wp_cache_add_global_groups( array( 'users', 'userlogins', 'usermeta', 'user_meta', 'site-transient', 'site-options', 'site-lookup', 'blog-lookup', 'blog-details', 'rss', 'global-posts' ) );
-		wp_cache_add_non_persistent_groups(array( 'comment', 'counts', 'plugins' ));
+			$global_groups = false;
+	
+		wp_cache_init();
+		if ( function_exists('wp_cache_add_global_groups') ) {
+			if ( is_array( $global_groups ) )
+				wp_cache_add_global_groups( $global_groups );
+			else
+				wp_cache_add_global_groups( array( 'users', 'userlogins', 'usermeta', 'user_meta', 'site-transient', 'site-options', 'site-lookup', 'blog-lookup', 'blog-details', 'rss', 'global-posts' ) );
+			wp_cache_add_non_persistent_groups(array( 'comment', 'counts', 'plugins' ));
+		}
 	}
 
 	do_action('switch_blog', $blog_id, $prev_blog_id);
@@ -551,18 +555,22 @@
 			$current_user->for_blog( $blog_id );
 	}
 
-	if ( is_object( $wp_object_cache ) && isset( $wp_object_cache->global_groups ) )
-		$global_groups = $wp_object_cache->global_groups;
-	else
-		$global_groups = false;
-
-	wp_cache_init();
-	if ( function_exists('wp_cache_add_global_groups') ) {
-		if ( is_array( $global_groups ) )
-			wp_cache_add_global_groups( $global_groups );
+	if ( function_exists( 'wp_cache_switch_to_blog' ) ) {
+		wp_cache_switch_to_blog( $blog_id );
+	} else {
+		if ( is_object( $wp_object_cache ) && isset( $wp_object_cache->global_groups ) )
+			$global_groups = $wp_object_cache->global_groups;
 		else
-			wp_cache_add_global_groups( array( 'users', 'userlogins', 'usermeta', 'user_meta', 'site-transient', 'site-options', 'site-lookup', 'blog-lookup', 'blog-details', 'rss', 'global-posts' ) );
-		wp_cache_add_non_persistent_groups(array( 'comment', 'counts', 'plugins' ));
+			$global_groups = false;
+	
+		wp_cache_init();
+		if ( function_exists('wp_cache_add_global_groups') ) {
+			if ( is_array( $global_groups ) )
+				wp_cache_add_global_groups( $global_groups );
+			else
+				wp_cache_add_global_groups( array( 'users', 'userlogins', 'usermeta', 'user_meta', 'site-transient', 'site-options', 'site-lookup', 'blog-lookup', 'blog-details', 'rss', 'global-posts' ) );
+			wp_cache_add_non_persistent_groups(array( 'comment', 'counts', 'plugins' ));
+		}
 	}
 
 	do_action('switch_blog', $blog_id, $prev_blog_id);
Index: wp-includes/cache.php
===================================================================
--- wp-includes/cache.php	(revision 21393)
+++ wp-includes/cache.php	(working copy)
@@ -180,6 +180,19 @@
 }
 
 /**
+ * Switch the interal blog id.
+ *
+ * This changes the blog id used to create keys in blog specific groups.
+ *
+ * @param int $blog_id Blog ID
+ */
+function wp_cache_switch_to_blog( $blog_id ) {
+	global $wp_object_cache;
+
+	return $wp_object_cache->switch_to_blog( $blog_id );
+}
+
+/**
  * Adds a group or set of groups to the list of global groups.
  *
  * @since 2.6.0
@@ -189,7 +202,7 @@
 function wp_cache_add_global_groups( $groups ) {
 	global $wp_object_cache;
 
-	return $wp_object_cache->add_global_groups($groups);
+	return $wp_object_cache->add_global_groups( $groups );
 }
 
 /**
@@ -271,6 +284,15 @@
 	var $global_groups = array();
 
 	/**
+	 * The blog prefix to prepend to keys in non-global groups.
+	 *
+	 * @var int
+	 * @access private
+	 * @since 3.5.0
+	 */
+	var $blog_prefix;
+
+	/**
 	 * Adds data to the cache if it doesn't already exist.
 	 *
 	 * @uses WP_Object_Cache::_exists Checks to see if the cache already has data.
@@ -292,7 +314,11 @@
 		if ( empty( $group ) )
 			$group = 'default';
 
-		if ( $this->_exists($key, $group) )
+		$id = $key;
+		if ( $this->multisite && ! in_array( $group, $this->global_groups ) )
+			$id = $this->blog_prefix . $key;
+
+		if ( $this->_exists( $id, $group ) )
 			return false;
 
 		return $this->set($key, $data, $group, $expire);
@@ -325,7 +351,10 @@
 	function decr( $key, $offset = 1, $group = 'default' ) {
 		if ( empty( $group ) )
 			$group = 'default';
-		
+
+		if ( $this->multisite && ! in_array( $group, $this->global_groups ) )
+			$key = $this->blog_prefix . $key;
+
 		if ( ! $this->_exists( $key, $group ) )
 			return false;
 
@@ -361,6 +390,9 @@
 		if ( empty( $group ) )
 			$group = 'default';
 
+		if ( $this->multisite && ! in_array( $group, $this->global_groups ) )
+			$key = $this->blog_prefix . $key;
+
 		if ( ! $force && ! $this->_exists( $key, $group ) )
 			return false;
 
@@ -402,6 +434,9 @@
 		if ( empty( $group ) )
 			$group = 'default';
 
+		if ( $this->multisite && ! in_array( $group, $this->global_groups ) )
+			$key = $this->blog_prefix . $key;
+
 		if ( $this->_exists( $key, $group ) ) {
 			$found = true;
 			$this->cache_hits += 1;
@@ -430,6 +465,9 @@
 		if ( empty( $group ) )
 			$group = 'default';
 
+		if ( $this->multisite && ! in_array( $group, $this->global_groups ) )
+			$key = $this->blog_prefix . $key;
+
 		if ( ! $this->_exists( $key, $group ) )
 			return false;
 
@@ -458,14 +496,18 @@
 	 * @param int $expire When to expire the cache contents
 	 * @return bool False if not exists, true if contents were replaced
 	 */
-	function replace($key, $data, $group = 'default', $expire = '') {
+	function replace( $key, $data, $group = 'default', $expire = '' ) {
 		if ( empty( $group ) )
 			$group = 'default';
 
-		if ( ! $this->_exists( $key, $group ) )
+		$id = $key;
+		if ( $this->multisite && ! in_array( $group, $this->global_groups ) )
+			$id = $this->blog_prefix . $key;
+
+		if ( ! $this->_exists( $id, $group ) )
 			return false;
 
-		return $this->set($key, $data, $group, $expire);
+		return $this->set( $key, $data, $group, $expire );
 	}
 
 	/**
@@ -475,9 +517,9 @@
 	 */
 	function reset() {
 		// Clear out non-global caches since the blog ID has changed.
-		foreach ( array_keys($this->cache) as $group ) {
-			if ( !in_array($group, $this->global_groups) )
-				unset($this->cache[$group]);
+		foreach ( array_keys( $this->cache ) as $group ) {
+			if ( !in_array( $group, $this->global_groups ) )
+				unset( $this->cache[$group] );
 		}
 	}
 
@@ -505,7 +547,10 @@
 		if ( empty( $group ) )
 			$group = 'default';
 
-		if ( is_object($data) )
+		if ( $this->multisite && ! in_array( $group, $this->global_groups ) )
+			$key = $this->blog_prefix . $key;
+
+		if ( is_object( $data ) )
 			$data = clone $data;
 
 		$this->cache[$group][$key] = $data;
@@ -533,6 +578,18 @@
 	}
 
 	/**
+	 * Switch the interal blog id.
+	 *
+	 * This changes the blog id used to create keys in blog specific groups.
+	 *
+	 * @param int $blog_id Blog ID
+	 */
+	function switch_to_blog( $blog_id ) {
+		$blog_id = (int) $blog_id;
+		$this->blog_prefix = $this->multisite ? $blog_id . ':' : '';
+	}
+
+	/**
 	 * Utility function to determine whether a key exists in the cache.
 	 *
 	 * @since 3.4.0
@@ -550,11 +607,17 @@
 	 * @return null|WP_Object_Cache If cache is disabled, returns null.
 	 */
 	function __construct() {
+		global $blog_id;
+
+		$this->multisite = is_multisite();
+		$this->blog_prefix =  $this->multisite ? $blog_id . ':' : '';
+		
+
 		/**
 		 * @todo This should be moved to the PHP4 style constructor, PHP5
 		 * already calls __destruct()
 		 */
-		register_shutdown_function(array(&$this, "__destruct"));
+		register_shutdown_function( array( &$this, "__destruct" ) );
 	}
 
 	/**
