Wikibase
MediaWiki Wikibase extension
Loading...
Searching...
No Matches
Wikibase\Lib\Store\EntityRevisionCache Class Reference

Service for caching the latest EntityRevision of an Entity. More...

Public Member Functions

 __construct (BagOStuff $cache, $cacheDuration=3600, $cacheKeyPrefix='wbentity')
 
 get (EntityId $entityId)
 Get the latest EntityRevision from cache.
 
 set (EntityRevision $entityRevision)
 Place the latest EntityRevision in the cache.
 
 delete (EntityId $entityId)
 Removes an Entity's EntityRevision from the cache.
 

Private Member Functions

 getCacheKey (EntityId $entityId)
 Returns a cache key suitable for the given entity.
 

Private Attributes

 $cache
 
 $cacheTimeout
 
 $cacheKeyPrefix
 

Detailed Description

Service for caching the latest EntityRevision of an Entity.

Author
Marius Hoch

Constructor & Destructor Documentation

◆ __construct()

Wikibase\Lib\Store\EntityRevisionCache::__construct ( BagOStuff $cache,
$cacheDuration = 3600,
$cacheKeyPrefix = 'wbentity' )
Parameters
BagOStuff$cacheThe cache to use
int$cacheDurationCache duration in seconds. Defaults to 3600 (1 hour).
string$cacheKeyPrefixThe key prefix to use for constructing cache keys. Defaults to "wbentity". There should be no reason to change this.

Member Function Documentation

◆ delete()

Wikibase\Lib\Store\EntityRevisionCache::delete ( EntityId $entityId)

Removes an Entity's EntityRevision from the cache.

Parameters
EntityId$entityId

◆ get()

Wikibase\Lib\Store\EntityRevisionCache::get ( EntityId $entityId)

Get the latest EntityRevision from cache.

Note: This might return stale data!

Parameters
EntityId$entityId
Returns
EntityRevision|null Null if the EntityRevision is not cached.

◆ getCacheKey()

Wikibase\Lib\Store\EntityRevisionCache::getCacheKey ( EntityId $entityId)
private

Returns a cache key suitable for the given entity.

Parameters
EntityId$entityId
Returns
string

◆ set()

Wikibase\Lib\Store\EntityRevisionCache::set ( EntityRevision $entityRevision)

Place the latest EntityRevision in the cache.

Parameters
EntityRevision$entityRevision

Member Data Documentation

◆ $cache

Wikibase\Lib\Store\EntityRevisionCache::$cache
private

◆ $cacheKeyPrefix

Wikibase\Lib\Store\EntityRevisionCache::$cacheKeyPrefix
private

◆ $cacheTimeout

Wikibase\Lib\Store\EntityRevisionCache::$cacheTimeout
private

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