Wikibase
MediaWiki Wikibase extension
|
Prefetches terms from the Cache or via the provided PrefetchingTermLookup if not cached. More...
Public Member Functions | |
__construct (CacheInterface $cache, PrefetchingTermLookup $lookup, RedirectResolvingLatestRevisionLookup $redirectResolvingRevisionLookup, ContentLanguages $termLanguages, ?int $ttl=null) | |
prefetchTerms (array $entityIds, array $termTypes, array $languageCodes) | |
Loads a set of terms into the buffer. More... | |
getPrefetchedTerm (EntityId $entityId, $termType, $languageCode) | |
Returns a term that was previously loaded by prefetchTerms. More... | |
getPrefetchedAliases (EntityId $entityId, $languageCode) | |
Returns terms that were previously loaded by prefetchTerms. More... | |
getLabel (EntityId $entityId, $languageCode) | |
Gets the label of an Entity with the specified EntityId and language code. More... | |
getDescription (EntityId $entityId, $languageCode) | |
Gets the description of an Entity with the specified EntityId and language code. More... | |
getLabels (EntityId $entityId, array $languageCodes) | |
Gets all labels of an Entity with the specified EntityId. More... | |
getDescriptions (EntityId $entityId, array $languageCodes) | |
Gets all descriptions of an Entity with the specified EntityId. More... | |
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 | |
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).
Wikibase\Lib\Store\CachingPrefetchingTermLookup::__construct | ( | CacheInterface | $cache, |
PrefetchingTermLookup | $lookup, | ||
RedirectResolvingLatestRevisionLookup | $redirectResolvingRevisionLookup, | ||
ContentLanguages | $termLanguages, | ||
?int | $ttl = null |
||
) |
|
private |
EntityId | $entityId | |
string | $termType | |
string | $languageCode | |
string | string[] | $freshTerm | string for existing label or description, string[] for existing aliases Should never be null or false |
|
private |
|
private |
|
private |
|
private |
|
private |
Wikibase\Lib\Store\CachingPrefetchingTermLookup::getDescription | ( | EntityId | $entityId, |
$languageCode | |||
) |
Gets the description of an Entity with the specified EntityId and language code.
EntityId | $entityId | |
string | $languageCode |
TermLookupException | for entity not found |
Implements Wikibase\DataModel\Services\Lookup\TermLookup.
Wikibase\Lib\Store\CachingPrefetchingTermLookup::getDescriptions | ( | EntityId | $entityId, |
array | $languageCodes | ||
) |
Gets all descriptions of an Entity with the specified EntityId.
If $languages is given, the result will contain the entries for the requested languages, if they exist.
EntityId | $entityId | |
string[] | $languageCodes | The list of languages to fetch |
TermLookupException | if the entity was not found (not guaranteed). |
Implements Wikibase\DataModel\Services\Lookup\TermLookup.
Wikibase\Lib\Store\CachingPrefetchingTermLookup::getLabel | ( | EntityId | $entityId, |
$languageCode | |||
) |
Gets the label of an Entity with the specified EntityId and language code.
EntityId | $entityId | |
string | $languageCode |
TermLookupException | for entity not found |
Implements Wikibase\DataModel\Services\Lookup\TermLookup.
Wikibase\Lib\Store\CachingPrefetchingTermLookup::getLabels | ( | EntityId | $entityId, |
array | $languageCodes | ||
) |
Gets all labels of an Entity with the specified EntityId.
The result will contain the entries for the requested languages, if they exist.
EntityId | $entityId | |
string[] | $languageCodes | The list of languages to fetch |
TermLookupException | if the entity was not found (not guaranteed). |
Implements Wikibase\DataModel\Services\Lookup\TermLookup.
|
private |
|
private |
|
private |
|
private |
Wikibase\Lib\Store\CachingPrefetchingTermLookup::getPrefetchedAliases | ( | EntityId | $entityId, |
$languageCode | |||
) |
Returns terms that were previously loaded by prefetchTerms.
EntityId | $entityId | |
string | $languageCode |
Implements Wikibase\DataAccess\AliasTermBuffer.
Wikibase\Lib\Store\CachingPrefetchingTermLookup::getPrefetchedTerm | ( | EntityId | $entityId, |
$termType, | |||
$languageCode | |||
) |
Returns a term that was previously loaded by prefetchTerms.
EntityId | $entityId | |
string | $termType | One of of TermTypes::TYPE_LABEL, TermTypes::TYPE_DESCRIPTION, TermTypes::TYPE_ALIAS |
string | $languageCode |
Implements Wikibase\DataModel\Services\Term\TermBuffer.
|
private |
|
private |
|
private |
|
private |
|
private |
Wikibase\Lib\Store\CachingPrefetchingTermLookup::prefetchTerms | ( | array | $entityIds, |
array | $termTypes, | ||
array | $languageCodes | ||
) |
Loads a set of terms into the buffer.
The source from which to fetch would typically be supplied to the buffer's constructor.
EntityId[] | $entityIds | |
string[] | $termTypes | The desired term types, i.e. any of TermTypes::TYPE_LABEL, TermTypes::TYPE_DESCRIPTION, TermTypes::TYPE_ALIAS |
string[] | $languageCodes | The desired languages. |
Implements Wikibase\DataModel\Services\Term\TermBuffer.
|
private |
EntityId | $entityId | |
string | $termType | |
string | $languageCode | |
string | string[] | false | $value | string for existing label or description, string[] for existing aliases, false for term known to not exist. |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |