MediaWiki master
|
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. | |
getAnythingId () | |
Get the ID that will be used for CACHE_ANYTHING. | |
getInstance ( $id) | |
Get a cached instance of the specified type of cache object. | |
getLocalClusterInstance () | |
Get the main cluster-local cache object. | |
getLocalServerInstance ( $fallback=CACHE_NONE) | |
Factory function for CACHE_ACCEL (referenced from configuration) | |
isDatabaseId ( $id) | |
Determine whether a config ID would access the database. | |
newFromParams (array $params) | |
Create a new cache object from parameters specification supplied. | |
Static Public Member Functions | |
static | makeLocalServerCache (string $keyspace) |
Create a new BagOStuff instance for local-server caching. | |
Public Attributes | |
const | CONSTRUCTOR_OPTIONS |
Static Public Attributes | |
static string | $localServerCacheClass |
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:
ObjectCacheFactory::getLocalClusterInstance() Purpose: Memory storage for per-cluster coordination and tracking. A typical use case would be a rate limit counter or cache regeneration mutex. Stored centrally within the local data-center. Not replicated to other DCs. Configured by $wgMainCacheType.
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 74 of file ObjectCacheFactory.php.
ObjectCacheFactory::__construct | ( | ServiceOptions | $options, |
StatsFactory | $stats, | ||
Spi | $loggerSpi, | ||
callable | $dbLoadBalancerFactory, | ||
string | $domainId ) |
Definition at line 105 of file ObjectCacheFactory.php.
References MediaWiki\Config\ServiceOptions\assertRequiredOptions().
ObjectCacheFactory::clear | ( | ) |
Clear all the cached instances.
Definition at line 331 of file ObjectCacheFactory.php.
ObjectCacheFactory::getAnythingId | ( | ) |
Get the ID that will be used for CACHE_ANYTHING.
Definition at line 360 of file ObjectCacheFactory.php.
References CACHE_ACCEL, CACHE_ANYTHING, CACHE_DB, and CACHE_NONE.
ObjectCacheFactory::getInstance | ( | $id | ) |
Get a cached instance of the specified type of cache object.
string | int | $id | A key in $wgObjectCaches. |
Definition at line 175 of file ObjectCacheFactory.php.
ObjectCacheFactory::getLocalClusterInstance | ( | ) |
Get the main cluster-local cache object.
Definition at line 457 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 316 of file ObjectCacheFactory.php.
References $fallback, and CACHE_NONE.
ObjectCacheFactory::isDatabaseId | ( | $id | ) |
Determine whether a config ID would access the database.
string | int | $id | A key in $wgObjectCaches |
Definition at line 430 of file ObjectCacheFactory.php.
References CACHE_ANYTHING.
|
static |
Create a new BagOStuff instance for local-server caching.
Only use this if you explicitly require the creation of a fresh instance. Whenever possible, use or inject the object from MediaWikiServices::getLocalServerObjectCache() instead.
NOTE: This method is called very early via Setup.php by ExtensionRegistry, and thus must remain fairly standalone so as to not cause initialization of the MediaWikiServices singleton.
string | $keyspace |
Definition at line 413 of file ObjectCacheFactory.php.
References $params.
ObjectCacheFactory::newFromParams | ( | array | $params | ) |
Create a new cache object from parameters specification supplied.
array | $params | Must have 'factory' or 'class' property.
|
Definition at line 198 of file ObjectCacheFactory.php.
References $params.
|
static |
Definition at line 103 of file ObjectCacheFactory.php.
const ObjectCacheFactory::CONSTRUCTOR_OPTIONS |
Definition at line 78 of file ObjectCacheFactory.php.