MediaWiki REL1_34
|
Functions to get cache objects. More...
Static Public Member Functions | |
static | clear () |
Clear all the cached instances. | |
static | detectLocalServerCache () |
Detects which local server cache library is present and returns a configuration for it. | |
static | getInstance ( $id) |
Get a cached instance of the specified type of cache object. | |
static | getLocalClusterInstance () |
Get the main cluster-local cache object. | |
static | getLocalServerInstance ( $fallback=CACHE_NONE) |
Factory function for CACHE_ACCEL (referenced from DefaultSettings.php) | |
static | getWANInstance ( $id) |
Get a cached instance of the specified type of WAN cache object. | |
static | newAnything ( $params) |
Factory function for CACHE_ANYTHING (referenced from DefaultSettings.php) | |
static | newFromParams ( $params) |
Create a new cache object from parameters. | |
static | newWANCacheFromParams (array $params) |
Create a new cache object of the specified type. | |
Static Public Attributes | |
static BagOStuff[] | $instances = [] |
Map of (id => BagOStuff) | |
static WANObjectCache[] | $wanInstances = [] |
Map of (id => WANObjectCache) | |
Static Private Member Functions | |
static | getDefaultKeyspace () |
Get the default keyspace for this wiki. | |
static | newFromId ( $id) |
Create a new cache object of the specified type. | |
static | newWANCacheFromId ( $id) |
Create a new cache object of the specified type. | |
Functions to get cache objects.
The word "cache" has two main dictionary meanings, and both are used in this factory class. They are:
The former should always use strongly consistent stores, so callers don't have to deal with stale reads. The latter may be eventually consistent, but callers can use BagOStuff:READ_LATEST to see the latest available data.
Primary entry points:
All the above cache instances (BagOStuff and WANObjectCache) 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 68 of file ObjectCache.php.
|
static |
Clear all the cached instances.
Definition at line 351 of file ObjectCache.php.
|
static |
Detects which local server cache library is present and returns a configuration for it.
Definition at line 362 of file ObjectCache.php.
References CACHE_NONE.
|
staticprivate |
Get the default keyspace for this wiki.
This is either the value of the CachePrefix
configuration variable, or (if the former is unset) the DBname
configuration variable, with DBprefix
(if defined).
Definition at line 139 of file ObjectCache.php.
References $wgCachePrefix.
|
static |
Get a cached instance of the specified type of cache object.
string | $id | A key in $wgObjectCaches. |
Definition at line 80 of file ObjectCache.php.
|
static |
Get the main cluster-local cache object.
Definition at line 342 of file ObjectCache.php.
References $wgMainCacheType.
|
static |
Factory function for CACHE_ACCEL (referenced from DefaultSettings.php)
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 268 of file ObjectCache.php.
References $cache, $fallback, and CACHE_NONE.
|
static |
Get a cached instance of the specified type of WAN cache object.
string | $id | A key in $wgWANObjectCaches. |
Definition at line 96 of file ObjectCache.php.
References wfDeprecated().
|
static |
Factory function for CACHE_ANYTHING (referenced from DefaultSettings.php)
CACHE_ANYTHING means that stuff has to be cached, not caching is not an option. If a caching method is configured for any of the main caches ($wgMainCacheType, $wgMessageCacheType, $wgParserCacheType), then CACHE_ANYTHING will effectively be an alias to the configured cache choice for that. If no cache choice is configured (by default $wgMainCacheType is CACHE_NONE), then CACHE_ANYTHING will forward to CACHE_DB.
array | $params |
Definition at line 226 of file ObjectCache.php.
References $cache, $wgMainCacheType, $wgMessageCacheType, $wgParserCacheType, CACHE_ANYTHING, CACHE_DB, and CACHE_NONE.
|
staticprivate |
Create a new cache object of the specified type.
string | $id | A key in $wgObjectCaches. |
InvalidArgumentException |
Definition at line 112 of file ObjectCache.php.
References $wgObjectCaches, and CACHE_NONE.
|
static |
Create a new cache object from parameters.
array | $params | Must have 'factory' or 'class' property. |
InvalidArgumentException |
Definition at line 161 of file ObjectCache.php.
References $GLOBALS.
|
staticprivate |
Create a new cache object of the specified type.
string | $id | A key in $wgWANObjectCaches. |
UnexpectedValueException |
Definition at line 288 of file ObjectCache.php.
References $wgObjectCaches, and $wgWANObjectCaches.
|
static |
Create a new cache object of the specified type.
array | $params |
UnexpectedValueException | PhanTypeMismatchReturn |
Definition at line 317 of file ObjectCache.php.
References $wgCommandLineMode, $wgSecretKey, and wfDeprecated().
|
static |
Map of (id => BagOStuff)
Definition at line 70 of file ObjectCache.php.
|
static |
Map of (id => WANObjectCache)
Definition at line 72 of file ObjectCache.php.