*
* - ObjectCache::getLocalServerInstance( $fallbackType )
* Purpose: Memory cache for very hot keys.
- * Stored only on the individual web server (typically APC for web requests,
+ * Stored only on the individual web server (typically APC or APCu for web requests,
* and EmptyBagOStuff in CLI mode).
* Not replicated to the other servers.
*
? $params['reportDupes']
: true;
// Do b/c logic for SqlBagOStuff
- if ( is_subclass_of( $class, SqlBagOStuff::class ) ) {
+ if ( is_a( $class, SqlBagOStuff::class, true ) ) {
if ( isset( $params['server'] ) && !isset( $params['servers'] ) ) {
$params['servers'] = [ $params['server'] ];
unset( $params['server'] );
/**
* Factory function for CACHE_ACCEL (referenced from DefaultSettings.php)
*
- * This will look for any APC style server-local cache.
+ * This will look for any APC or APCu style server-local cache.
* A fallback cache can be specified if none is found.
*
* // Direct calls
* @since 1.27
*/
public static function getLocalServerInstance( $fallback = CACHE_NONE ) {
- if ( function_exists( 'apc_fetch' ) ) {
- $id = 'apc';
- } elseif ( function_exists( 'xcache_get' ) && wfIniGetBool( 'xcache.var_size' ) ) {
- $id = 'xcache';
- } elseif ( function_exists( 'wincache_ucache_get' ) ) {
- $id = 'wincache';
- } else {
+ $cache = MediaWikiServices::getInstance()->getLocalServerObjectCache();
+ if ( $cache instanceof EmptyBagOStuff ) {
if ( is_array( $fallback ) ) {
- $id = isset( $fallback['fallback'] ) ? $fallback['fallback'] : CACHE_NONE;
- } else {
- $id = $fallback;
+ $fallback = isset( $fallback['fallback'] ) ? $fallback['fallback'] : CACHE_NONE;
}
+ $cache = self::getInstance( $fallback );
}
- return self::getInstance( $id );
+ return $cache;
}
/**
*
* @since 1.26
* @return WANObjectCache
+ * @deprecated Since 1.28 Use MediaWikiServices::getMainWANCache()
*/
public static function getMainWANInstance() {
- global $wgMainWANCache;
-
- return self::getWANInstance( $wgMainWANCache );
+ return MediaWikiServices::getInstance()->getMainWANObjectCache();
}
/**
*
* @return BagOStuff
* @since 1.26
+ * @deprecated Since 1.28 Use MediaWikiServices::getMainObjectStash
*/
public static function getMainStashInstance() {
- global $wgMainStash;
-
- return self::getInstance( $wgMainStash );
+ return MediaWikiServices::getInstance()->getMainObjectStash();
}
/**