MediaWiki  1.28.0
CachingSiteStore Class Reference
Inheritance diagram for CachingSiteStore:
Collaboration diagram for CachingSiteStore:

Public Member Functions

 __construct (SiteStore $siteStore, BagOStuff $cache, $cacheKey=null, $cacheTimeout=3600)
 
 clear ()
 Clears the list of sites stored. More...
 
 getSite ($globalId)
 
 getSites ()
 
 reset ()
 Purges the internal and external cache of the site list, forcing the list. More...
 
 saveSite (Site $site)
 
 saveSites (array $sites)
 

Private Member Functions

 getCacheKey ()
 Constructs a cache key to use for caching the list of sites. More...
 

Private Attributes

BagOStuff $cache
 
string null $cacheKey
 
int $cacheTimeout
 
SiteList null $sites = null
 
SiteStore $siteStore
 

Detailed Description

Definition at line 31 of file CachingSiteStore.php.

Constructor & Destructor Documentation

CachingSiteStore::__construct ( SiteStore  $siteStore,
BagOStuff  $cache,
  $cacheKey = null,
  $cacheTimeout = 3600 
)
Parameters
SiteStore$siteStore
BagOStuff$cache
string | null$cacheKey
int$cacheTimeout

Definition at line 64 of file CachingSiteStore.php.

References $cache, $cacheKey, $cacheTimeout, $siteStore, and cache.

Member Function Documentation

CachingSiteStore::clear ( )

Clears the list of sites stored.

Only use this for testing, as APC is typically used and is per-server.

See also
SiteStore::clear()
Returns
bool Success

Implements SiteStore.

Definition at line 193 of file CachingSiteStore.php.

References reset().

CachingSiteStore::getCacheKey ( )
private

Constructs a cache key to use for caching the list of sites.

This includes the concrete class name of the site list as well as a version identifier for the list's serialization, to avoid problems when unserializing site lists serialized by an older version, e.g. when reading from a cache.

The cache key also includes information about where the sites were loaded from, e.g. the name of a database table.

See also
SiteList::getSerialVersionId
Returns
string The cache key.

Definition at line 90 of file CachingSiteStore.php.

References $cacheKey, $type, SiteList\getSerialVersionId(), and wfMemcKey().

Referenced by getSites(), and reset().

CachingSiteStore::getSite (   $globalId)
See also
SiteStore::getSite
Since
1.25
Parameters
string$globalId
Returns
Site|null

Implements SiteLookup.

Definition at line 129 of file CachingSiteStore.php.

References getSites().

CachingSiteStore::getSites ( )
See also
SiteStore::getSites
Since
1.25
Returns
SiteList

Implements SiteLookup.

Definition at line 106 of file CachingSiteStore.php.

References $sites, cache, and getCacheKey().

Referenced by getSite().

CachingSiteStore::reset ( )

Purges the internal and external cache of the site list, forcing the list.

of sites to be reloaded.

Only use this for testing, as APC is typically used and is per-server

Since
1.25

Definition at line 178 of file CachingSiteStore.php.

References cache, and getCacheKey().

Referenced by clear(), and saveSites().

CachingSiteStore::saveSite ( Site  $site)
See also
SiteStore::saveSite
Since
1.25
Parameters
Site$site
Returns
bool Success indicator

Implements SiteStore.

Definition at line 144 of file CachingSiteStore.php.

References saveSites().

CachingSiteStore::saveSites ( array  $sites)
See also
SiteStore::saveSites
Since
1.25
Parameters
Site[]$sites
Returns
bool Success indicator

Implements SiteStore.

Definition at line 157 of file CachingSiteStore.php.

References $success, and reset().

Referenced by saveSite().

Member Data Documentation

BagOStuff CachingSiteStore::$cache
private

Definition at line 51 of file CachingSiteStore.php.

Referenced by __construct().

string null CachingSiteStore::$cacheKey
private

Definition at line 41 of file CachingSiteStore.php.

Referenced by __construct(), and getCacheKey().

int CachingSiteStore::$cacheTimeout
private

Definition at line 46 of file CachingSiteStore.php.

Referenced by __construct().

SiteList null CachingSiteStore::$sites = null
private

Definition at line 36 of file CachingSiteStore.php.

Referenced by getSites().

SiteStore CachingSiteStore::$siteStore
private

Definition at line 56 of file CachingSiteStore.php.

Referenced by __construct().


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