/**
* Object Cache API
*
- * @link https://codex.wordpress.org/Function_Reference/WP_Cache
+ * @link https://codex.wordpress.org/Class_Reference/WP_Object_Cache
*
* @package WordPress
* @subpackage Cache
* @param string $group Optional. Where the cache contents are grouped. Default empty.
* @param bool $force Optional. Whether to force an update of the local cache from the persistent
* cache. Default false.
- * @param bool &$found Optional. Whether the key was found in the cache. Disambiguates a return of false,
+ * @param bool $found Optional. Whether the key was found in the cache. Disambiguates a return of false,
* a storable value. Passed by reference. Default null.
* @return bool|mixed False on failure to retrieve contents or the cache
* contents on success
}
/**
- * Switches the interal blog ID.
+ * Switches the internal blog ID.
*
* This changes the blog id used to create keys in blog specific groups.
*
* @see WP_Object_Cache::switch_to_blog()
* @global WP_Object_Cache $wp_object_cache Object cache global instance.
*
- * @param int $blog_id Blog ID.
+ * @param int $blog_id Site ID.
*/
function wp_cache_switch_to_blog( $blog_id ) {
global $wp_object_cache;
/**
* Reset internal cache keys and structures.
*
- * If the cache backend uses global blog or site IDs as part of its cache keys,
- * this function instructs the backend to reset those keys and perform any cleanup
+ * If the cache back end uses global blog or site IDs as part of its cache keys,
+ * this function instructs the back end to reset those keys and perform any cleanup
* since blog or site IDs have changed since cache init.
*
* This function is deprecated. Use wp_cache_switch_to_blog() instead of this
* function when preparing the cache for a blog switch. For clearing the cache
* during unit tests, consider using wp_cache_init(). wp_cache_init() is not
- * recommended outside of unit tests as the performance penality for using it is
+ * recommended outside of unit tests as the performance penalty for using it is
* high.
*
* @since 2.6.0
* @global WP_Object_Cache $wp_object_cache Object cache global instance.
*/
function wp_cache_reset() {
- _deprecated_function( __FUNCTION__, '3.5' );
+ _deprecated_function( __FUNCTION__, '3.5.0' );
global $wp_object_cache;
* The amount of times the cache data was already stored in the cache.
*
* @since 2.5.0
- * @access private
+ * @access public
* @var int
*/
- private $cache_hits = 0;
+ public $cache_hits = 0;
/**
* Amount of times the cache did not have the request in cache.
private $multisite;
/**
- * Makes private properties readable for backwards compatibility.
+ * Makes private properties readable for backward compatibility.
*
* @since 4.0.0
* @access public
}
/**
- * Makes private properties settable for backwards compatibility.
+ * Makes private properties settable for backward compatibility.
*
* @since 4.0.0
* @access public
}
/**
- * Makes private properties checkable for backwards compatibility.
+ * Makes private properties checkable for backward compatibility.
*
* @since 4.0.0
* @access public
}
/**
- * Makes private properties un-settable for backwards compatibility.
+ * Makes private properties un-settable for backward compatibility.
*
* @since 4.0.0
* @access public
* @param string $group Optional. Where the cache contents are grouped. Default 'default'.
* @param string $force Optional. Unused. Whether to force a refetch rather than relying on the local
* cache. Default false.
- * @param bool &$found Optional. Whether the key was found in the cache. Disambiguates a return of
+ * @param bool $found Optional. Whether the key was found in the cache. Disambiguates a return of
* false, a storable value. Passed by reference. Default null.
* @return false|mixed False on failure to retrieve contents or the cache contents on success.
*/
* @see switch_to_blog()
*/
public function reset() {
- _deprecated_function( __FUNCTION__, '3.5', 'switch_to_blog()' );
+ _deprecated_function( __FUNCTION__, '3.5.0', 'switch_to_blog()' );
// Clear out non-global caches since the blog ID has changed.
foreach ( array_keys( $this->cache ) as $group ) {
}
/**
- * Switches the interal blog ID.
+ * Switches the internal blog ID.
*
* This changes the blog ID used to create keys in blog specific groups.
*
* Sets up object properties; PHP 5 style constructor.
*
* @since 2.0.8
- *
- * @global int $blog_id Global blog ID.
*/
public function __construct() {
- global $blog_id;
-
$this->multisite = is_multisite();
- $this->blog_prefix = $this->multisite ? $blog_id . ':' : '';
+ $this->blog_prefix = $this->multisite ? get_current_blog_id() . ':' : '';
/**