Wikibase
MediaWiki Wikibase extension
Wikibase\Client\DataAccess\Scribunto\CachingFallbackBasedTermLookup Class Reference

This TermLookup allows exposes language based lookups for getLabel and getDescription and is backed by the shared TermFallbackCache which stores TermFallback objects. More...

+ Inheritance diagram for Wikibase\Client\DataAccess\Scribunto\CachingFallbackBasedTermLookup:
+ Collaboration diagram for Wikibase\Client\DataAccess\Scribunto\CachingFallbackBasedTermLookup:

Public Member Functions

 __construct (TermFallbackCacheFacade $termFallbackCacheFacade, RedirectResolvingLatestRevisionLookup $redirectResolvingLatestRevisionLookup, LanguageFallbackLabelDescriptionLookupFactory $lookupFactory, LanguageFactory $languageFactory, ContentLanguages $contentLanguages)
 
 getLabel (EntityId $entityId, $languageCode)
 
 getDescription (EntityId $entityId, $languageCode)
 
 getLabels (EntityId $entityId, array $languageCodes)
 
 getDescriptions (EntityId $entityId, array $languageCodes)
 

Private Member Functions

 getTerm (EntityId $entityId, string $languageCode, string $termType)
 
 getLookup (Language $language)
 
 lookupWithoutCache (EntityId $entityId, Language $language, $termType)
 

Private Attributes

 $termFallbackCache
 
 $redirectResolvingLatestRevisionLookup
 
 $lookupFactory
 
 $languageFactory
 
 $contentLanguages
 
 $lookups
 

Detailed Description

This TermLookup allows exposes language based lookups for getLabel and getDescription and is backed by the shared TermFallbackCache which stores TermFallback objects.

The lookup tries to find the term in the cache and if not present builds a LanguageFallbackLabelDescriptionLookup based on the TermFallbackChain generated by the requested Language.

If the requested language does not match the actual language of the TermFallback this value will still be written to the cache but not returned.

If the TermFallback returns null this value will also be written to the cache as this means no term is available in the requested language.

See also
TermFallbackCacheFacade

Constructor & Destructor Documentation

◆ __construct()

Wikibase\Client\DataAccess\Scribunto\CachingFallbackBasedTermLookup::__construct ( TermFallbackCacheFacade  $termFallbackCacheFacade,
RedirectResolvingLatestRevisionLookup  $redirectResolvingLatestRevisionLookup,
LanguageFallbackLabelDescriptionLookupFactory  $lookupFactory,
LanguageFactory  $languageFactory,
ContentLanguages  $contentLanguages 
)

Member Function Documentation

◆ getDescription()

Wikibase\Client\DataAccess\Scribunto\CachingFallbackBasedTermLookup::getDescription ( EntityId  $entityId,
  $languageCode 
)

◆ getDescriptions()

Wikibase\Client\DataAccess\Scribunto\CachingFallbackBasedTermLookup::getDescriptions ( EntityId  $entityId,
array  $languageCodes 
)

◆ getLabel()

Wikibase\Client\DataAccess\Scribunto\CachingFallbackBasedTermLookup::getLabel ( EntityId  $entityId,
  $languageCode 
)

◆ getLabels()

Wikibase\Client\DataAccess\Scribunto\CachingFallbackBasedTermLookup::getLabels ( EntityId  $entityId,
array  $languageCodes 
)

◆ getLookup()

Wikibase\Client\DataAccess\Scribunto\CachingFallbackBasedTermLookup::getLookup ( Language  $language)
private

◆ getTerm()

Wikibase\Client\DataAccess\Scribunto\CachingFallbackBasedTermLookup::getTerm ( EntityId  $entityId,
string  $languageCode,
string  $termType 
)
private

◆ lookupWithoutCache()

Wikibase\Client\DataAccess\Scribunto\CachingFallbackBasedTermLookup::lookupWithoutCache ( EntityId  $entityId,
Language  $language,
  $termType 
)
private
Parameters
EntityId$entityId
Language$language
$termType
Returns
TermFallback|null

Member Data Documentation

◆ $contentLanguages

Wikibase\Client\DataAccess\Scribunto\CachingFallbackBasedTermLookup::$contentLanguages
private

◆ $languageFactory

Wikibase\Client\DataAccess\Scribunto\CachingFallbackBasedTermLookup::$languageFactory
private

◆ $lookupFactory

Wikibase\Client\DataAccess\Scribunto\CachingFallbackBasedTermLookup::$lookupFactory
private

◆ $lookups

Wikibase\Client\DataAccess\Scribunto\CachingFallbackBasedTermLookup::$lookups
private

◆ $redirectResolvingLatestRevisionLookup

Wikibase\Client\DataAccess\Scribunto\CachingFallbackBasedTermLookup::$redirectResolvingLatestRevisionLookup
private

◆ $termFallbackCache

Wikibase\Client\DataAccess\Scribunto\CachingFallbackBasedTermLookup::$termFallbackCache
private

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