* Function that gets called when initialization is done.
*
* @since 1.20
- * @var callable
+ * @var callable|null
*/
- protected $onInitHandler = false;
+ protected $onInitHandler;
/**
* Elements to build a cache key with.
$this->hasCached = is_array( $cachedChunks );
$this->cachedChunks = $this->hasCached ? $cachedChunks : [];
- if ( $this->onInitHandler !== false ) {
+ if ( $this->onInitHandler !== null ) {
call_user_func( $this->onInitHandler, $this->hasCached );
}
}
throw new MWException( 'No cache key set, so cannot obtain or save the CacheHelper values.' );
}
- return wfMemcKey( ...array_values( $this->cacheKey ) );
+ return ObjectCache::getLocalClusterInstance()->makeKey(
+ ...array_values( $this->cacheKey )
+ );
}
/**