Makes it more convenient to use.
Change-Id: I1e11f7a759bd2816e47d1c2453cbe39b8f44b2f0
// See if the compiled PHP code is stored in cache.
// CACHE_ACCEL throws an exception if no suitable object cache is present, so fall
// back to CACHE_ANYTHING.
- $cache = ObjectCache::newAccelerator( array(), CACHE_ANYTHING );
+ $cache = ObjectCache::newAccelerator( CACHE_ANYTHING );
$key = wfMemcKey( 'template', $templateName, $fastHash );
$code = $this->forceRecompile ? null : $cache->get( $key );
$this->mExpiry = $expiry;
if ( $wgUseLocalMessageCache ) {
- $this->localCache = ObjectCache::newAccelerator( array(), CACHE_NONE );
+ $this->localCache = ObjectCache::newAccelerator( CACHE_NONE );
} else {
$this->localCache = wfGetCache( CACHE_NONE );
}
$this->parent = $parent;
- $this->srvCache = ObjectCache::newAccelerator( array(), 'hash' );
+ $this->srvCache = ObjectCache::newAccelerator( 'hash' );
$this->mainCache = $wgMemc ?: wfGetMainCache();
}
$this->srvCache = wfGetMainCache(); // preferrably memcached
} else {
try { // look for APC, XCache, WinCache, ect...
- $this->srvCache = ObjectCache::newAccelerator( array() );
+ $this->srvCache = ObjectCache::newAccelerator();
} catch ( Exception $e ) {
}
}
// Tracks peers that couldn't be queried recently to avoid lengthy
// connection timeouts. This is useless if each bucket has one peer.
try {
- $this->statusCache = ObjectCache::newAccelerator( array() );
+ $this->statusCache = ObjectCache::newAccelerator();
} catch ( Exception $e ) {
trigger_error( __CLASS__ .
" using multiple DB peers without apc, xcache, or wincache." );
* This will look for any APC style server-local cache.
* A fallback cache can be specified if none is found.
*
- * @param array $params
+ * @param array $params [optional]
* @param int|string $fallback Fallback cache, e.g. (CACHE_NONE, "hash") (since 1.24)
* @return BagOStuff
* @throws MWException
*/
- static function newAccelerator( $params, $fallback = null ) {
+ static function newAccelerator( $params = array(), $fallback = null ) {
+ if ( !is_array( $params ) && $fallback === null ) {
+ $fallback = $params;
+ }
if ( function_exists( 'apc_fetch' ) ) {
$id = 'apc';
} elseif ( function_exists( 'xcache_get' ) && wfIniGetBool( 'xcache.var_size' ) ) {
// we don't want to fail here if $wgObjectCaches is not configured
// properly for APC setup
try {
- $this->cache = ObjectCache::newAccelerator( array() );
+ $this->cache = ObjectCache::newAccelerator();
} catch ( MWException $e ) {
$this->cache = new EmptyBagOStuff();
}
// Setup salt cache. Use APC, or fallback to the main cache if it isn't setup
try {
- $cache = ObjectCache::newAccelerator( array() );
+ $cache = ObjectCache::newAccelerator();
} catch ( Exception $e ) {
$cache = wfGetMainCache();
}
$cache = null;
if ( ( $flags & self::QUICK_VOLATILE ) && PHP_SAPI !== 'cli' ) {
try {
- $cache = ObjectCache::newAccelerator( array() );
+ $cache = ObjectCache::newAccelerator();
} catch ( Exception $e ) {
// not supported
}