MediaWiki REL1_34
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.
 
 getSite ( $globalId)
 
 getSites ()
 
 reset ()
 Purges the internal and external cache of the site list, forcing the list.
 
 saveSite (Site $site)
 
 saveSites (array $sites)
 

Private Member Functions

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

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

◆ __construct()

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, and $siteStore.

Member Function Documentation

◆ clear()

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().

◆ getCacheKey()

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, and SiteList\getSerialVersionId().

Referenced by getSites(), and reset().

◆ getSite()

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 $sites, SiteList\getSite(), getSites(), and SiteList\hasSite().

◆ getSites()

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

Implements SiteLookup.

Definition at line 106 of file CachingSiteStore.php.

References $sites, and getCacheKey().

Referenced by getSite().

◆ reset()

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 getCacheKey().

Referenced by clear(), and saveSites().

◆ saveSite()

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().

◆ 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 $sites, $success, and reset().

Referenced by saveSite().

Member Data Documentation

◆ $cache

BagOStuff CachingSiteStore::$cache
private

Definition at line 51 of file CachingSiteStore.php.

Referenced by __construct().

◆ $cacheKey

string null CachingSiteStore::$cacheKey
private

Definition at line 41 of file CachingSiteStore.php.

Referenced by __construct(), and getCacheKey().

◆ $cacheTimeout

int CachingSiteStore::$cacheTimeout
private

Definition at line 46 of file CachingSiteStore.php.

Referenced by __construct().

◆ $sites

SiteList null CachingSiteStore::$sites = null
private

Definition at line 36 of file CachingSiteStore.php.

Referenced by getSite(), getSites(), and saveSites().

◆ $siteStore

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: