Wikibase
MediaWiki Wikibase extension
|
Prefetches from TermIndex(DB) and stores them in MapCacheLRU (current process only). More...
Public Member Functions | |||||||
__construct (TermIndex $termIndex, $bufferSize=1000) | |||||||
prefetchTerms (array $entityIds, array $termTypes, array $languageCodes) | |||||||
Loads a set of terms into the buffer. | |||||||
getPrefetchedTerm (EntityId $entityId, $termType, $languageCode) | |||||||
Returns a term that was previously loaded by prefetchTerms. | |||||||
getPrefetchedAliases (EntityId $entityId, $languageCode) | |||||||
Returns terms that were previously loaded by prefetchTerms.
| |||||||
Public Member Functions inherited from Wikibase\Lib\Store\EntityTermLookupBase | |||||||
getLabel (EntityId $entityId, $languageCode) | |||||||
getLabels (EntityId $entityId, array $languageCodes) | |||||||
getDescription (EntityId $entityId, $languageCode) | |||||||
getDescriptions (EntityId $entityId, array $languageCodes) | |||||||
Protected Member Functions | |
getTermsOfType (EntityId $entityId, $termType, array $languageCodes) | |
Get terms from the TermBuffer but falls back to TermIndex if languages are requested that have no previously been fetched. | |
Protected Member Functions inherited from Wikibase\Lib\Store\EntityTermLookupBase | |
convertTermsToMap (array $wikibaseTerms) | |
Private Member Functions | |
getBufferKey (EntityId $entityId, string $termType, string $languageCode) | |
getBufferKeyWithEntityIdString (string $entityIdSerialization, string $termType, string $languageCode) | |
getBufferKeys (array $entityIds, array $termTypes, array $languageCodes) | |
Sets they keys for the given combinations of entity, type and language to false if they are not currently in the buffer (and not in $skipKeys). | |
getIncompletelyPrefetchedEntityIds (array $entityIds, array $termTypes, array $languageCodes) | |
Get a list of EntityIds for which we don't have all the needed data prefetched for. | |
isIncompletelyPrefetched (EntityId $entityId, array $termTypes, array $languageCodes) | |
Has the term type and language code combination from the given entity already been prefeteched? | |
getBufferedTerms (EntityId $entityId, $termType, array $languageCodes) | |
setBufferedTermObjects (array $terms) | |
setBufferedTermObject (string $key, string $type, array $termsOfLanguage) | |
setUndefinedTerms (array $entityIds, array $termTypes, array $languageCodes, array $skipKeys) | |
Sets they keys for the given combinations of entity, type and language to false if they are not currently in the buffer (and not in $skipKeys). | |
stripUndefinedTerms (array $terms) | |
Remove all non-string entries from an array. | |
groupEntityIds (array $entityIds) | |
Private Attributes | |
$buffer | |
$termIndex | |
Prefetches from TermIndex(DB) and stores them in MapCacheLRU (current process only).
Looks up terms from MapCacheLRU, but also falls back to TermIndex(DB) in the case that requested languages have not already been fetched.
This extra fetch fallback behaviour is not the norm in currently PrefetchingTermLookup implementations. Per the stats call that has been added, it doesnt appear to happen in Wikidata production. This odd extra logic will be removed along with this class when wb_terms is finally killed.
Wikibase\Lib\Store\BufferingTermIndexTermLookup::__construct | ( | TermIndex | $termIndex, |
$bufferSize = 1000 |
|||
) |
TermIndex | $termIndex | |
int | $bufferSize |
|
private |
EntityId | $entityId | |
string | $termType | |
string[] | $languageCodes | The language codes to try |
|
private |
|
private |
Sets they keys for the given combinations of entity, type and language to false if they are not currently in the buffer (and not in $skipKeys).
EntityId[] | $entityIds | |
string[] | $termTypes | |
string[] | $languageCodes |
|
private |
|
private |
Get a list of EntityIds for which we don't have all the needed data prefetched for.
EntityId[] | $entityIds | |
string[] | $termTypes | |
string[] | $languageCodes |
Wikibase\Lib\Store\BufferingTermIndexTermLookup::getPrefetchedAliases | ( | EntityId | $entityId, |
$languageCode | |||
) |
Returns terms that were previously loaded by prefetchTerms.
EntityId | $entityId | |
string | $languageCode |
Implements Wikibase\DataAccess\AliasTermBuffer.
Wikibase\Lib\Store\BufferingTermIndexTermLookup::getPrefetchedTerm | ( | EntityId | $entityId, |
$termType, | |||
$languageCode | |||
) |
Returns a term that was previously loaded by prefetchTerms.
EntityId | $entityId | |
string | $termType | |
string | $languageCode |
|
protected |
Get terms from the TermBuffer but falls back to TermIndex if languages are requested that have no previously been fetched.
EntityId | $entityId | |
string | $termType | |
string[] | $languageCodes | The languages to get terms for |
Reimplemented from Wikibase\Lib\Store\EntityTermLookupBase.
|
private |
EntityId[] | $entityIds |
|
private |
Has the term type and language code combination from the given entity already been prefeteched?
EntityId | $entityId | |
string[] | $termTypes | |
string[] | $languageCodes |
Wikibase\Lib\Store\BufferingTermIndexTermLookup::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[] | null | $termTypes | |
string[] | null | $languageCodes |
StorageException |
|
private |
string | $key | |
string | $type | |
TermIndexEntry[] | $termsOfLanguage |
|
private |
TermIndexEntry[] | $terms |
|
private |
Sets they keys for the given combinations of entity, type and language to false if they are not currently in the buffer (and not in $skipKeys).
EntityId[] | $entityIds | |
string[] | $termTypes | |
string[] | $languageCodes | |
string[] | $skipKeys | Keys known to refer to existing terms. |
|
private |
Remove all non-string entries from an array.
Useful for getting rid of negative cache entries. Still allows arrays to be stored for aliases.
string[] | $terms |
|
private |
|
private |