Wikibase
MediaWiki Wikibase extension
Wikibase\Lib\TermFallbackCache\TermFallbackCacheFacade Class Reference

TermFallbackCacheFacade is class to allow for simplified interaction with the shared cache used for storing TermFallback objects (also known as the term fallback cache or formatter cache). More...

Public Member Functions

 __construct (CacheInterface $cache, int $cacheTtlInSeconds)
 
 get (EntityId $targetEntityId, int $revisionId, string $languageCode, string $termType)
 
 set (?TermFallback $termFallback, EntityId $targetEntityId, int $revisionId, string $languageCode, string $termType)
 

Public Attributes

const NO_VALUE = false
 

Private Attributes

 $cache
 
 $cacheTtlInSeconds
 

Detailed Description

TermFallbackCacheFacade is class to allow for simplified interaction with the shared cache used for storing TermFallback objects (also known as the term fallback cache or formatter cache).

The cache returns TermFallbackCacheFacade::NO_VALUE in the case there is no entry in the cache.

Storing null values is also allowed as this indicates we have already checked the database for the term but found nothing.

Constructor & Destructor Documentation

◆ __construct()

Wikibase\Lib\TermFallbackCache\TermFallbackCacheFacade::__construct ( CacheInterface  $cache,
int  $cacheTtlInSeconds 
)

Member Function Documentation

◆ get()

Wikibase\Lib\TermFallbackCache\TermFallbackCacheFacade::get ( EntityId  $targetEntityId,
int  $revisionId,
string  $languageCode,
string  $termType 
)
Parameters
EntityId$targetEntityId
int$revisionId
string$languageCode
string$termType
Returns
false|TermFallback|null
  • returning null indicates we have already checked the database and stored it's null response in the cache.
  • returning false indicates there is no cache entry.

◆ set()

Wikibase\Lib\TermFallbackCache\TermFallbackCacheFacade::set ( ?TermFallback  $termFallback,
EntityId  $targetEntityId,
int  $revisionId,
string  $languageCode,
string  $termType 
)
Parameters
null | TermFallback$termFallback
EntityId$targetEntityId
int$revisionId
string$languageCode
string$termType

Member Data Documentation

◆ $cache

Wikibase\Lib\TermFallbackCache\TermFallbackCacheFacade::$cache
private

◆ $cacheTtlInSeconds

Wikibase\Lib\TermFallbackCache\TermFallbackCacheFacade::$cacheTtlInSeconds
private

◆ NO_VALUE

const Wikibase\Lib\TermFallbackCache\TermFallbackCacheFacade::NO_VALUE = false

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