protected $mainCache;
public function __construct( $parent ) {
- global $wgMemc;
-
$this->parent = $parent;
- $this->srvCache = ObjectCache::newAccelerator( array(), 'hash' );
- $this->mainCache = $wgMemc ?: wfGetMainCache();
+ $this->srvCache = ObjectCache::newAccelerator( 'hash' );
+ $this->mainCache = wfGetMainCache();
}
public function scaleLoads( &$loads, $group = false, $wiki = false ) {
if ( $this->mainCache->lock( $key, 0, 10 ) ) {
# Let this process alone update the cache value
$cache = $this->mainCache;
+ /** @noinspection PhpUnusedLocalVariableInspection */
$unlocker = new ScopedCallback( function () use ( $cache, $key ) {
$cache->unlock( $key );
} );
} elseif ( $staleValue ) {
# Could not acquire lock but an old cache exists, so use it
- return $value['lagTimes'];
+ return $staleValue['lagTimes'];
}
$lagTimes = array();