*
* - 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
* // From $wgObjectCaches via newFromParams()
* ObjectCache::getLocalServerInstance( [ 'fallback' => $fallbackType ] );
*
- * @param int|string $fallback Fallback cache ID
+ * @param int|string|array $fallback Fallback cache or parameter map with 'fallback'
* @return BagOStuff
* @throws InvalidArgumentException
* @since 1.27
- * @deprecated Since 1.28; use MediaWikiServices::getLocalServerObjectCache
*/
public static function getLocalServerInstance( $fallback = CACHE_NONE ) {
$cache = MediaWikiServices::getInstance()->getLocalServerObjectCache();
-
- return ( $cache instanceof EmptyBagOStuff )
- ? self::getInstance( $fallback )
- : $cache;
- }
-
- /**
- * @param array $params [optional] Array key 'fallback' for $fallback.
- * @param int|string $fallback Fallback cache, e.g. (CACHE_NONE, "hash") (since 1.24)
- * @return BagOStuff
- * @deprecated since 1.27
- */
- public static function newAccelerator( $params = [], $fallback = null ) {
- if ( $fallback === null ) {
- if ( is_array( $params ) && isset( $params['fallback'] ) ) {
- $fallback = $params['fallback'];
- } elseif ( !is_array( $params ) ) {
- $fallback = $params;
+ if ( $cache instanceof EmptyBagOStuff ) {
+ if ( is_array( $fallback ) ) {
+ $fallback = isset( $fallback['fallback'] ) ? $fallback['fallback'] : CACHE_NONE;
}
+ $cache = self::getInstance( $fallback );
}
- return self::getLocalServerInstance( $fallback );
+ return $cache;
}
/**
* @throws UnexpectedValueException
*/
public static function newWANCacheFromParams( array $params ) {
+ $erGroup = MediaWikiServices::getInstance()->getEventRelayerGroup();
foreach ( $params['channels'] as $action => $channel ) {
- $params['relayers'][$action] = MediaWikiServices::getInstance()->getEventRelayerGroup()
- ->getRelayer( $channel );
+ $params['relayers'][$action] = $erGroup->getRelayer( $channel );
$params['channels'][$action] = $channel;
}
$params['cache'] = self::newFromParams( $params['store'] );
*
* @since 1.26
* @return WANObjectCache
- * @deprecated Since 1.28 Use MediaWikiServices::getMainWANCache()
+ * @deprecated Since 1.28 Use MediaWikiServices::getMainWANObjectCache()
*/
public static function getMainWANInstance() {
return MediaWikiServices::getInstance()->getMainWANObjectCache();