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

Wraps another label description lookup to resolve redirects and add caching. More...

+ Inheritance diagram for Wikibase\Lib\Store\CachingFallbackLabelDescriptionLookup:
+ Collaboration diagram for Wikibase\Lib\Store\CachingFallbackLabelDescriptionLookup:

Public Member Functions

 __construct (TermFallbackCacheFacade $fallbackCache, RedirectResolvingLatestRevisionLookup $redirectResolvingRevisionLookup, FallbackLabelDescriptionLookup $labelDescriptionLookup, TermLanguageFallbackChain $termLanguageFallbackChain)
 
 getDescription (EntityId $entityId)
 
 getLabel (EntityId $entityId)
 

Private Member Functions

 getTerm (EntityId $entityId, $languageCode, $termName=self::LABEL)
 

Private Attributes

const LABEL = 'label'
 
const DESCRIPTION = 'description'
 
 $cache
 
 $redirectResolvingRevisionLookup
 
 $labelDescriptionLookup
 
 $termLanguageFallbackChain
 

Detailed Description

Wraps another label description lookup to resolve redirects and add caching.

Use FallbackLabelDescriptionLookupFactory instead of using this class directly.

Note
The class uses immutable cache approach: cached data never changes once persisted. For this purpose we not only include Item ID in cache key construction, but also Item's current revision ID. Revisions never change, the cached data does not need to change either, which means that we don't need to purge caches. As soon as new revision is created, cache key will change and old cache data will eventually be purged by the caching system (eg. APC, Memcached, ...) based on a Least Recently Used strategy as soon as no code will request it anymore.

Constructor & Destructor Documentation

◆ __construct()

Wikibase\Lib\Store\CachingFallbackLabelDescriptionLookup::__construct ( TermFallbackCacheFacade $fallbackCache,
RedirectResolvingLatestRevisionLookup $redirectResolvingRevisionLookup,
FallbackLabelDescriptionLookup $labelDescriptionLookup,
TermLanguageFallbackChain $termLanguageFallbackChain )
Parameters
TermFallbackCacheFacade$fallbackCache
RedirectResolvingLatestRevisionLookup$redirectResolvingRevisionLookup
FallbackLabelDescriptionLookup$labelDescriptionLookup
TermLanguageFallbackChain$termLanguageFallbackChain

Member Function Documentation

◆ getDescription()

Wikibase\Lib\Store\CachingFallbackLabelDescriptionLookup::getDescription ( EntityId $entityId)
Parameters
EntityId$entityId
Exceptions
LabelDescriptionLookupException
Returns
TermFallback|null

Implements Wikibase\Lib\Store\FallbackLabelDescriptionLookup.

◆ getLabel()

Wikibase\Lib\Store\CachingFallbackLabelDescriptionLookup::getLabel ( EntityId $entityId)
Parameters
EntityId$entityId
Exceptions
LabelDescriptionLookupException
Returns
TermFallback|null

Implements Wikibase\Lib\Store\FallbackLabelDescriptionLookup.

◆ getTerm()

Wikibase\Lib\Store\CachingFallbackLabelDescriptionLookup::getTerm ( EntityId $entityId,
$languageCode,
$termName = self::LABEL )
private

Member Data Documentation

◆ $cache

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

◆ $labelDescriptionLookup

Wikibase\Lib\Store\CachingFallbackLabelDescriptionLookup::$labelDescriptionLookup
private

◆ $redirectResolvingRevisionLookup

Wikibase\Lib\Store\CachingFallbackLabelDescriptionLookup::$redirectResolvingRevisionLookup
private

◆ $termLanguageFallbackChain

Wikibase\Lib\Store\CachingFallbackLabelDescriptionLookup::$termLanguageFallbackChain
private

◆ DESCRIPTION

const Wikibase\Lib\Store\CachingFallbackLabelDescriptionLookup::DESCRIPTION = 'description'
private

◆ LABEL

const Wikibase\Lib\Store\CachingFallbackLabelDescriptionLookup::LABEL = 'label'
private

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