Wikibase
MediaWiki Wikibase extension
Loading...
Searching...
No Matches
Wikibase\Lib\Store\AbstractTermPropertyLabelResolver Class Reference

Resolves property labels (which are unique per language) into entity IDs, uses in-process caching. More...

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

Public Member Functions

 __construct ( $languageCode, BagOStuff $cache, $cacheDuration, $cacheKey)
 
 getPropertyIdsForLabels (array $labels, $recache='')
 

Protected Member Functions

 getLabelMap ( $recache='')
 Returns a map of labels to EntityIds for all Properties currently defined.
 
 loadProperties ()
 
 getCachedLabelMap ( $recache)
 
 needsRecache (array $propertyIds)
 Checks if recache is needed.
 

Protected Attributes

 $languageCode
 

Private Attributes

 $cache
 
 $cacheDuration
 
 $cacheKey
 
 $propertiesByLabel = null
 

Detailed Description

Resolves property labels (which are unique per language) into entity IDs, uses in-process caching.

Author
Daniel Kinzler
Katie Filbert < aude..nosp@m.wiki.nosp@m.@gmai.nosp@m.l.co.nosp@m.m >

Constructor & Destructor Documentation

◆ __construct()

Wikibase\Lib\Store\AbstractTermPropertyLabelResolver::__construct (   $languageCode,
BagOStuff  $cache,
  $cacheDuration,
  $cacheKey 
)
Parameters
string$languageCodeThe language of the labels to look up (typically, the wiki's content language)
BagOStuff$cacheThe cache to use for labels (typically from wfGetMainCache())
int$cacheDurationNumber of seconds to keep the cached version for. Defaults to 3600 seconds = 1 hour.
string$cacheKeyThe cache key to use, auto-generated based on $lang per default. Should be set to something including the wiki name of the wiki that maintains the properties.

Member Function Documentation

◆ getCachedLabelMap()

Wikibase\Lib\Store\AbstractTermPropertyLabelResolver::getCachedLabelMap (   $recache)
protected
Parameters
mixed$recache
Returns
array|false

◆ getLabelMap()

Wikibase\Lib\Store\AbstractTermPropertyLabelResolver::getLabelMap (   $recache = '')
protected

Returns a map of labels to EntityIds for all Properties currently defined.

The information is taking from the cache if possible, and loaded from a TermIndex if not.

Parameters
string$recacheFlag, set to 'recache' to fetch fresh data from the database.
Returns
EntityId[]

◆ getPropertyIdsForLabels()

Wikibase\Lib\Store\AbstractTermPropertyLabelResolver::getPropertyIdsForLabels ( array  $labels,
  $recache = '' 
)
Parameters
string[]$labels
string$recacheFlag, set to 'recache' to fetch fresh data from the database.
Returns
EntityId[] a map of strings from $labels to the corresponding entity ID.

◆ loadProperties()

Wikibase\Lib\Store\AbstractTermPropertyLabelResolver::loadProperties ( )
abstractprotected

◆ needsRecache()

Wikibase\Lib\Store\AbstractTermPropertyLabelResolver::needsRecache ( array  $propertyIds)
protected

Checks if recache is needed.

Parameters
array$propertyIds
Returns
bool

Member Data Documentation

◆ $cache

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

◆ $cacheDuration

Wikibase\Lib\Store\AbstractTermPropertyLabelResolver::$cacheDuration
private

◆ $cacheKey

Wikibase\Lib\Store\AbstractTermPropertyLabelResolver::$cacheKey
private

◆ $languageCode

Wikibase\Lib\Store\AbstractTermPropertyLabelResolver::$languageCode
protected

◆ $propertiesByLabel

Wikibase\Lib\Store\AbstractTermPropertyLabelResolver::$propertiesByLabel = null
private

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