Wikibase
MediaWiki Wikibase extension
Loading...
Searching...
No Matches
Wikibase\Lib\Store\CachingFallbackLabelDescriptionLookup Class Reference
+ Inheritance diagram for Wikibase\Lib\Store\CachingFallbackLabelDescriptionLookup:
+ Collaboration diagram for Wikibase\Lib\Store\CachingFallbackLabelDescriptionLookup:

Public Member Functions

 __construct (CacheInterface $cache, RedirectResolvingLatestRevisionLookup $redirectResolvingRevisionLookup, FallbackLabelDescriptionLookup $labelDescriptionLookup, LanguageFallbackChain $languageFallbackChain, $cacheTtlInSeconds)
 
 getDescription (EntityId $entityId)
 
 getLabel (EntityId $entityId)
 

Public Attributes

const FIELD_LANGUAGE = 'language'
 
const FIELD_VALUE = 'value'
 
const FIELD_REQUEST_LANGUAGE = 'requestLanguage'
 
const FIELD_SOURCE_LANGUAGE = 'sourceLanguage'
 
const NO_VALUE = 'no value in cache'
 

Private Member Functions

 getTerm (EntityId $entityId, $languageCode, $termName=self::LABEL)
 
 serialize (TermFallback $termFallback=null)
 
 unserialize ( $serialized)
 

Private Attributes

const LABEL = 'label'
 
const DESCRIPTION = 'description'
 
 $cache
 
 $redirectResolvingRevisionLookup
 
 $labelDescriptionLookup
 
 $languageFallbackChain
 
 $cacheTtlInSeconds
 

Detailed Description

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 doesn not need to change as well, what 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, ...) as Least Recently Used as soon as no code will request it.

Constructor & Destructor Documentation

◆ __construct()

Wikibase\Lib\Store\CachingFallbackLabelDescriptionLookup::__construct ( CacheInterface  $cache,
RedirectResolvingLatestRevisionLookup  $redirectResolvingRevisionLookup,
FallbackLabelDescriptionLookup  $labelDescriptionLookup,
LanguageFallbackChain  $languageFallbackChain,
  $cacheTtlInSeconds 
)
Parameters
CacheInterface$cache
RedirectResolvingLatestRevisionLookup$redirectResolvingRevisionLookup
FallbackLabelDescriptionLookup$labelDescriptionLookup
LanguageFallbackChain$languageFallbackChain
int$cacheTtlInSeconds

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

◆ serialize()

Wikibase\Lib\Store\CachingFallbackLabelDescriptionLookup::serialize ( TermFallback  $termFallback = null)
private
Parameters
TermFallback | null$termFallback
Returns
array|null

◆ unserialize()

Wikibase\Lib\Store\CachingFallbackLabelDescriptionLookup::unserialize (   $serialized)
private
Parameters
array | null$serialized
Returns
null|TermFallback

Member Data Documentation

◆ $cache

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

◆ $cacheTtlInSeconds

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

◆ $labelDescriptionLookup

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

◆ $languageFallbackChain

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

◆ $redirectResolvingRevisionLookup

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

◆ DESCRIPTION

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

◆ FIELD_LANGUAGE

const Wikibase\Lib\Store\CachingFallbackLabelDescriptionLookup::FIELD_LANGUAGE = 'language'

◆ FIELD_REQUEST_LANGUAGE

const Wikibase\Lib\Store\CachingFallbackLabelDescriptionLookup::FIELD_REQUEST_LANGUAGE = 'requestLanguage'

◆ FIELD_SOURCE_LANGUAGE

const Wikibase\Lib\Store\CachingFallbackLabelDescriptionLookup::FIELD_SOURCE_LANGUAGE = 'sourceLanguage'

◆ FIELD_VALUE

const Wikibase\Lib\Store\CachingFallbackLabelDescriptionLookup::FIELD_VALUE = 'value'

◆ LABEL

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

◆ NO_VALUE

const Wikibase\Lib\Store\CachingFallbackLabelDescriptionLookup::NO_VALUE = 'no value in cache'

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