Wikibase
MediaWiki Wikibase extension
Wikibase\Lib\Store\CachingPrefetchingTermLookup Class Reference

Prefetches terms from the Cache or via the provided PrefetchingTermLookup if not cached. More...

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

Public Member Functions

 __construct (CacheInterface $cache, PrefetchingTermLookup $lookup, RedirectResolvingLatestRevisionLookup $redirectResolvingRevisionLookup, ContentLanguages $termLanguages, ?int $ttl=null)
 
 prefetchTerms (array $entityIds, array $termTypes, array $languageCodes)
 
 getPrefetchedTerm (EntityId $entityId, $termType, $languageCode)
 
 getPrefetchedAliases (EntityId $entityId, $languageCode)
 Returns terms that were previously loaded by prefetchTerms. More...
 
 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)
 
 prefetchCachedTerms (array $entityIds, array $termTypes, array $languageCodes)
 
 getCacheKeys (array $entityIds, array $termTypes, array $languageCodes)
 
 prefetchAndCache (array $uncachedIds, array $uncachedTermTypes, array $uncachedLanguageCodes)
 
 getPrefetchedTermsFromLookup (array $entitiesToPrefetch, array $languagesToPrefetch, array $termTypes)
 
 getTermFromLookup (EntityId $entity, string $termType, string $language)
 
 setPrefetchedTermBuffer (EntityId $entityId, string $termType, string $languageCode, $value)
 
 bufferAndCacheExistingTerm (EntityId $entityId, string $termType, string $languageCode, $freshTerm)
 
 bufferAndCacheMissingTerm (EntityId $entityId, string $termType, string $languageCode)
 
 getCacheKey (EntityId $id, string $language, string $termType)
 
 getBufferedOrCachedEntry (EntityId $entityId, string $termType, string $languageCode)
 
 getMultipleTermsByLanguageFromBuffer (EntityId $entityId, string $termType, array $languages)
 
 getMultipleTermsByLanguageFromCache (EntityId $entityId, string $termType, array $languages)
 
 getMultipleTermsByLanguageFromLookup (EntityId $entityId, string $termType, array $languages)
 
 getMultipleTermsByLanguage (EntityId $entityId, string $termType, array $languages)
 
 filterValidTermLanguages (array $languageCodes)
 

Private Attributes

const DEFAULT_TTL = 60
 
const RESOLVED_KEYS = 'resolvedKeys'
 
const UNRESOLVED_IDS = 'unresolvedIds'
 
const KEY_PARTS_MAP = 'keyPartsMap'
 
const UNCACHED_IDS = 'uncachedIds'
 
const UNCACHED_TERM_TYPES = 'uncachedTermTypes'
 
const UNCACHED_LANGUAGE_CODES = 'uncachedLanguageCodes'
 
const ENTITY_ID = 'entityId'
 
const TERM_TYPE = 'termType'
 
const LANGUAGE_CODE = 'languageCode'
 
 $cacheEntryTTL
 
 $cache
 
 $prefetchedTerms
 
 $lookup
 
 $redirectResolvingRevisionLookup
 
 $termLanguages
 

Detailed Description

Prefetches terms from the Cache or via the provided PrefetchingTermLookup if not cached.

Terms requested via the TermLookup methods are also buffered and cached.

CacheInterface determines the medium of caching, and thus the availability (process, server, WAN).

Constructor & Destructor Documentation

◆ __construct()

Wikibase\Lib\Store\CachingPrefetchingTermLookup::__construct ( CacheInterface  $cache,
PrefetchingTermLookup  $lookup,
RedirectResolvingLatestRevisionLookup  $redirectResolvingRevisionLookup,
ContentLanguages  $termLanguages,
?int  $ttl = null 
)

Member Function Documentation

◆ bufferAndCacheExistingTerm()

Wikibase\Lib\Store\CachingPrefetchingTermLookup::bufferAndCacheExistingTerm ( EntityId  $entityId,
string  $termType,
string  $languageCode,
  $freshTerm 
)
private
Parameters
EntityId$entityId
string$termType
string$languageCode
string | string[]$freshTermstring for existing label or description, string[] for existing aliases Should never be null or false
See also
bufferAndCacheMissingTerm

◆ bufferAndCacheMissingTerm()

Wikibase\Lib\Store\CachingPrefetchingTermLookup::bufferAndCacheMissingTerm ( EntityId  $entityId,
string  $termType,
string  $languageCode 
)
private

◆ filterValidTermLanguages()

Wikibase\Lib\Store\CachingPrefetchingTermLookup::filterValidTermLanguages ( array  $languageCodes)
private

◆ getBufferedOrCachedEntry()

Wikibase\Lib\Store\CachingPrefetchingTermLookup::getBufferedOrCachedEntry ( EntityId  $entityId,
string  $termType,
string  $languageCode 
)
private

◆ getCacheKey()

Wikibase\Lib\Store\CachingPrefetchingTermLookup::getCacheKey ( EntityId  $id,
string  $language,
string  $termType 
)
private

◆ getCacheKeys()

Wikibase\Lib\Store\CachingPrefetchingTermLookup::getCacheKeys ( array  $entityIds,
array  $termTypes,
array  $languageCodes 
)
private

◆ getDescription()

Wikibase\Lib\Store\CachingPrefetchingTermLookup::getDescription ( EntityId  $entityId,
  $languageCode 
)

◆ getDescriptions()

Wikibase\Lib\Store\CachingPrefetchingTermLookup::getDescriptions ( EntityId  $entityId,
array  $languageCodes 
)

◆ getLabel()

Wikibase\Lib\Store\CachingPrefetchingTermLookup::getLabel ( EntityId  $entityId,
  $languageCode 
)

◆ getLabels()

Wikibase\Lib\Store\CachingPrefetchingTermLookup::getLabels ( EntityId  $entityId,
array  $languageCodes 
)

◆ getMultipleTermsByLanguage()

Wikibase\Lib\Store\CachingPrefetchingTermLookup::getMultipleTermsByLanguage ( EntityId  $entityId,
string  $termType,
array  $languages 
)
private

◆ getMultipleTermsByLanguageFromBuffer()

Wikibase\Lib\Store\CachingPrefetchingTermLookup::getMultipleTermsByLanguageFromBuffer ( EntityId  $entityId,
string  $termType,
array  $languages 
)
private

◆ getMultipleTermsByLanguageFromCache()

Wikibase\Lib\Store\CachingPrefetchingTermLookup::getMultipleTermsByLanguageFromCache ( EntityId  $entityId,
string  $termType,
array  $languages 
)
private

◆ getMultipleTermsByLanguageFromLookup()

Wikibase\Lib\Store\CachingPrefetchingTermLookup::getMultipleTermsByLanguageFromLookup ( EntityId  $entityId,
string  $termType,
array  $languages 
)
private

◆ getPrefetchedAliases()

Wikibase\Lib\Store\CachingPrefetchingTermLookup::getPrefetchedAliases ( EntityId  $entityId,
  $languageCode 
)

Returns terms that were previously loaded by prefetchTerms.

Parameters
EntityId$entityId
string$languageCode
Returns
string[]|false|null The aliases, or false of that entity has no aliases, or null if the term was not yet requested via prefetchTerms().

Implements Wikibase\DataAccess\AliasTermBuffer.

◆ getPrefetchedTerm()

Wikibase\Lib\Store\CachingPrefetchingTermLookup::getPrefetchedTerm ( EntityId  $entityId,
  $termType,
  $languageCode 
)

◆ getPrefetchedTermsFromLookup()

Wikibase\Lib\Store\CachingPrefetchingTermLookup::getPrefetchedTermsFromLookup ( array  $entitiesToPrefetch,
array  $languagesToPrefetch,
array  $termTypes 
)
private

◆ getTerm()

Wikibase\Lib\Store\CachingPrefetchingTermLookup::getTerm ( EntityId  $entityId,
string  $languageCode,
string  $termType 
)
private

◆ getTermFromLookup()

Wikibase\Lib\Store\CachingPrefetchingTermLookup::getTermFromLookup ( EntityId  $entity,
string  $termType,
string  $language 
)
private

◆ prefetchAndCache()

Wikibase\Lib\Store\CachingPrefetchingTermLookup::prefetchAndCache ( array  $uncachedIds,
array  $uncachedTermTypes,
array  $uncachedLanguageCodes 
)
private

◆ prefetchCachedTerms()

Wikibase\Lib\Store\CachingPrefetchingTermLookup::prefetchCachedTerms ( array  $entityIds,
array  $termTypes,
array  $languageCodes 
)
private

◆ prefetchTerms()

Wikibase\Lib\Store\CachingPrefetchingTermLookup::prefetchTerms ( array  $entityIds,
array  $termTypes,
array  $languageCodes 
)

◆ setPrefetchedTermBuffer()

Wikibase\Lib\Store\CachingPrefetchingTermLookup::setPrefetchedTermBuffer ( EntityId  $entityId,
string  $termType,
string  $languageCode,
  $value 
)
private
Parameters
EntityId$entityId
string$termType
string$languageCode
string | string[] | false$valuestring for existing label or description, string[] for existing aliases, false for term known to not exist.

Member Data Documentation

◆ $cache

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

◆ $cacheEntryTTL

Wikibase\Lib\Store\CachingPrefetchingTermLookup::$cacheEntryTTL
private

◆ $lookup

Wikibase\Lib\Store\CachingPrefetchingTermLookup::$lookup
private

◆ $prefetchedTerms

Wikibase\Lib\Store\CachingPrefetchingTermLookup::$prefetchedTerms
private

◆ $redirectResolvingRevisionLookup

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

◆ $termLanguages

Wikibase\Lib\Store\CachingPrefetchingTermLookup::$termLanguages
private

◆ DEFAULT_TTL

const Wikibase\Lib\Store\CachingPrefetchingTermLookup::DEFAULT_TTL = 60
private

◆ ENTITY_ID

const Wikibase\Lib\Store\CachingPrefetchingTermLookup::ENTITY_ID = 'entityId'
private

◆ KEY_PARTS_MAP

const Wikibase\Lib\Store\CachingPrefetchingTermLookup::KEY_PARTS_MAP = 'keyPartsMap'
private

◆ LANGUAGE_CODE

const Wikibase\Lib\Store\CachingPrefetchingTermLookup::LANGUAGE_CODE = 'languageCode'
private

◆ RESOLVED_KEYS

const Wikibase\Lib\Store\CachingPrefetchingTermLookup::RESOLVED_KEYS = 'resolvedKeys'
private

◆ TERM_TYPE

const Wikibase\Lib\Store\CachingPrefetchingTermLookup::TERM_TYPE = 'termType'
private

◆ UNCACHED_IDS

const Wikibase\Lib\Store\CachingPrefetchingTermLookup::UNCACHED_IDS = 'uncachedIds'
private

◆ UNCACHED_LANGUAGE_CODES

const Wikibase\Lib\Store\CachingPrefetchingTermLookup::UNCACHED_LANGUAGE_CODES = 'uncachedLanguageCodes'
private

◆ UNCACHED_TERM_TYPES

const Wikibase\Lib\Store\CachingPrefetchingTermLookup::UNCACHED_TERM_TYPES = 'uncachedTermTypes'
private

◆ UNRESOLVED_IDS

const Wikibase\Lib\Store\CachingPrefetchingTermLookup::UNRESOLVED_IDS = 'unresolvedIds'
private

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