Skip to content

Instantly share code, notes, and snippets.

@jbrinley
Last active December 29, 2015 08:09
Show Gist options
  • Save jbrinley/7641703 to your computer and use it in GitHub Desktop.
Save jbrinley/7641703 to your computer and use it in GitHub Desktop.
<?php
/**
* Switch the interal blog id.
*
* This changes the blog id used to create keys in blog specific groups.
*
* @since 3.5.0
*
* @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 );
}
class WP_Object_Cache {
/* ... */
function switch_to_blog( $blog_id ) {
global $table_prefix;
$blog_id = (int) $blog_id;
$this->blog_prefix = WP_MEMCACHED_KEY_SALT.':';
$this->blog_prefix .= ( is_multisite() ? $blog_id : $table_prefix ) . ':';
}
/* ... */
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment