MediaWiki  1.23.2
ObjectCache Class Reference

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 newAccelerator ( $params)
 Factory function referenced from DefaultSettings.php for CACHE_ACCEL. More...
 
static newAnything ( $params)
 Factory function referenced from DefaultSettings.php for CACHE_ANYTHING. More...
 
static newFromId ( $id)
 Create a new cache object of the specified type. More...
 
static newFromParams ( $params)
 Create a new cache object from parameters. More...
 
static newMemcached ( $params)
 Factory function that creates a memcached client object. More...
 

Static Public Attributes

static $instances = array()
 

Detailed Description

Functions to get cache objects.

Definition at line 29 of file ObjectCache.php.

Member Function Documentation

◆ clear()

static ObjectCache::clear ( )
static

Clear all the cached instances.

Definition at line 52 of file ObjectCache.php.

References array().

Referenced by ForkController\prepareEnvironment().

◆ getInstance()

static ObjectCache::getInstance (   $id)
static

Get a cached instance of the specified type of cache object.

Parameters
$idstring
Returns
BagOStuff

Definition at line 39 of file ObjectCache.php.

References newFromId().

Referenced by ObjectCacheSessionHandler\getCache(), and newAnything().

◆ newAccelerator()

static ObjectCache::newAccelerator (   $params)
static

Factory function referenced from DefaultSettings.php for CACHE_ACCEL.

Parameters
$paramsarray
Exceptions
MWException
Returns
BagOStuff

Definition at line 125 of file ObjectCache.php.

References newFromId(), and wfIniGetBool().

Referenced by DBLockManager\__construct(), SwiftFileBackend\__construct(), and UIDGenerator\getSequentialPerNodeIDs().

◆ newAnything()

static ObjectCache::newAnything (   $params)
static

Factory function referenced from DefaultSettings.php for CACHE_ANYTHING.

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.

Parameters
$paramsarray
Returns
BagOStuff

Definition at line 107 of file ObjectCache.php.

References array(), as, CACHE_ANYTHING, CACHE_DB, CACHE_NONE, getInstance(), and global.

◆ newFromId()

static ObjectCache::newFromId (   $id)
static

Create a new cache object of the specified type.

Parameters
$idstring
Exceptions
MWException
Returns
BagOStuff

Definition at line 64 of file ObjectCache.php.

References global, and newFromParams().

Referenced by getInstance(), newAccelerator(), and BagOStuffTest\setUp().

◆ newFromParams()

static ObjectCache::newFromParams (   $params)
static

Create a new cache object from parameters.

Parameters
$paramsarray
Exceptions
MWException
Returns
BagOStuff

Definition at line 83 of file ObjectCache.php.

References $params.

Referenced by MultiWriteBagOStuff\__construct(), MemcLockManager\__construct(), and newFromId().

◆ newMemcached()

static ObjectCache::newMemcached (   $params)
static

Factory function that creates a memcached client object.

This always uses the PHP client, since the PECL client has a different hashing scheme and a different interpretation of the flags bitfield, so switching between the two clients randomly would be disastrous.

Parameters
$paramsarray
Returns
MemcachedPhpBagOStuff

Definition at line 150 of file ObjectCache.php.

References $params.

Member Data Documentation

◆ $instances

ObjectCache::$instances = array()
static
Examples
/src/tests/phpunit/MediaWikiTestCase.php.

Definition at line 30 of file ObjectCache.php.

Referenced by MediaWikiTestCase\run().


The documentation for this class was generated from the following file: