MediaWiki 1.42.1
|
Factory for cache objects as configured in the ObjectCaches setting. More...
Public Member Functions | |
__construct (ServiceOptions $options, StatsFactory $stats, Spi $loggerSpi, callable $dbLoadBalancerFactory, string $domainId) | |
clear () | |
Clear all the cached instances. | |
getInstance ( $id) | |
Get a cached instance of the specified type of cache object. | |
getLocalServerInstance ( $fallback=CACHE_NONE) | |
Factory function for CACHE_ACCEL (referenced from configuration) | |
newFromParams (array $params) | |
setInstanceForTesting ( $cacheId, BagOStuff $cache) | |
Factory for cache objects as configured in the ObjectCaches setting.
The word "cache" has two main dictionary meanings, and both are used in this factory class. They are:
Primary entry points:
All the above BagOStuff cache instances have their makeKey() method scoped to the current wiki ID. Use makeGlobalKey() to avoid this scoping when using keys that need to be shared amongst wikis.
Definition at line 59 of file ObjectCacheFactory.php.
ObjectCacheFactory::__construct | ( | ServiceOptions | $options, |
StatsFactory | $stats, | ||
Spi | $loggerSpi, | ||
callable | $dbLoadBalancerFactory, | ||
string | $domainId ) |
Definition at line 84 of file ObjectCacheFactory.php.
References MediaWiki\Config\ServiceOptions\assertRequiredOptions().
ObjectCacheFactory::clear | ( | ) |
Clear all the cached instances.
Definition at line 307 of file ObjectCacheFactory.php.
ObjectCacheFactory::getInstance | ( | $id | ) |
Get a cached instance of the specified type of cache object.
string | int | $id | A key in $wgObjectCaches. |
Definition at line 151 of file ObjectCacheFactory.php.
ObjectCacheFactory::getLocalServerInstance | ( | $fallback = CACHE_NONE | ) |
Factory function for CACHE_ACCEL (referenced from configuration)
This will look for any APC or APCu style server-local cache. A fallback cache can be specified if none is found.
// Direct calls ObjectCache::getLocalServerInstance( $fallbackType ); // From $wgObjectCaches via newFromParams() ObjectCache::getLocalServerInstance( [ 'fallback' => $fallbackType ] );
int | string | array | $fallback | Fallback cache or parameter map with 'fallback' |
InvalidArgumentException |
Definition at line 292 of file ObjectCacheFactory.php.
References $fallback, and CACHE_NONE.
ObjectCacheFactory::newFromParams | ( | array | $params | ) |
Create a new cache object from parameters specification supplied.
array | $params | Must have 'factory' or 'class' property. |
Definition at line 174 of file ObjectCacheFactory.php.
References $params.
ObjectCacheFactory::setInstanceForTesting | ( | $cacheId, | |
BagOStuff | $cache ) |
string | int | $cacheId | |
BagOStuff | $cache |
Definition at line 318 of file ObjectCacheFactory.php.