MediaWiki
master
|
Functions to get cache objects. More...
Static Public Member Functions | |
static | clear () |
Clear all the cached instances. More... | |
static | getInstance ( $id) |
Get a cached instance of the specified type of cache object. More... | |
static | getLocalClusterInstance () |
Get the main cluster-local cache object. More... | |
static | getLocalServerInstance ( $fallback=CACHE_NONE) |
Factory function for CACHE_ACCEL (referenced from configuration) More... | |
static | isDatabaseId ( $id) |
Determine whether a config ID would access the database. More... | |
static | makeLocalServerCache () |
Create a new BagOStuff instance for local-server caching. More... | |
static | newAnything ( $params) |
Factory function for CACHE_ANYTHING (referenced by configuration) More... | |
static | newFromParams (array $params, MediaWikiServices $services=null) |
Create a new cache object from parameters. More... | |
Static Public Attributes | |
static BagOStuff[] | $instances = [] |
Map of (id => BagOStuff) More... | |
static string | $localServerCacheClass |
Functions to get cache objects.
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 67 of file ObjectCache.php.
|
static |
Clear all the cached instances.
Definition at line 353 of file ObjectCache.php.
Referenced by MediaWiki\MediaWikiServices\disableStorage(), and MediaWiki\Maintenance\ForkController\prepareEnvironment().
|
static |
Get a cached instance of the specified type of cache object.
string | int | $id | A key in $wgObjectCaches. |
Definition at line 83 of file ObjectCache.php.
Referenced by MediaWiki\Session\SessionManager\__construct(), MediaWiki\Specials\SpecialVersion\getCreditsForExtension(), getLocalServerInstance(), LanguageConverter\loadTables(), and newAnything().
|
static |
Get the main cluster-local cache object.
Definition at line 320 of file ObjectCache.php.
Referenced by MediaWiki\Auth\ThrottlePreAuthenticationProvider\__construct(), MediaWiki\Auth\Throttler\__construct(), MediaWiki\Auth\AuthManager\autoCreateUser(), ResetAuthenticationThrottle\clearLoginThrottle(), ResetAuthenticationThrottle\clearSignupThrottle(), MediaWiki\Auth\AuthManager\continueAccountCreation(), FileCacheBase\getMissesRecent(), FileCacheBase\incrMissesRecent(), MediaWiki\User\BotPassword\login(), JobQueueGroup\push(), JobQueueGroup\queuesHaveJobs(), MediaWiki\ResourceLoader\ResourceLoader\saveModuleDependenciesInternal(), WikiPage\triggerOpportunisticLinksUpdate(), and wfGenerateThumbnail().
|
static |
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 302 of file ObjectCache.php.
References $fallback, CACHE_NONE, and getInstance().
Referenced by MediaWiki\Html\TemplateParser\__construct(), and MediaWiki\ResourceLoader\FileModule\compileLessString().
|
static |
Determine whether a config ID would access the database.
string | int | $id | A key in $wgObjectCaches |
Definition at line 330 of file ObjectCache.php.
References $wgObjectCaches.
|
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.
Definition at line 371 of file ObjectCache.php.
|
static |
Factory function for CACHE_ANYTHING (referenced by configuration)
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 246 of file ObjectCache.php.
References getInstance().
|
static |
Create a new cache object from parameters.
array | $params | Must have 'factory' or 'class' property. |
MediaWikiServices | null | $services | [internal] |
Definition at line 147 of file ObjectCache.php.
|
static |
Map of (id => BagOStuff)
Definition at line 69 of file ObjectCache.php.
|
static |
Definition at line 75 of file ObjectCache.php.