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

SiteLinkLookup implementation that caches the obtained data (except for data obtained via "getLinks"). More...

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

Public Member Functions

 __construct (SiteLinkLookup $siteLinkLookup, BagOStuff $cache, $cacheDuration=3600, $cacheKeyPrefix='wikibase')
 
 getItemIdForLink (string $globalSiteId, string $pageTitle)
 Returns the id of the item that is equivalent to the provided page, or null if there is none. More...
 
 getLinks (?array $numericIds=null, ?array $siteIds=null, ?array $pageNames=null)
 This is uncached! More...
 
 getSiteLinksForItem (ItemId $itemId)
 Returns an array of SiteLink objects for an item. More...
 
 getItemIdForSiteLink (SiteLink $siteLink)
 

Private Member Functions

 getByPageCacheKey (string $globalSiteId, string $pageTitle)
 
 getAndCacheItemIdForLink (string $globalSiteId, string $pageTitle)
 

Private Attributes

 $lookup
 
 $cache
 
 $cacheDuration
 
 $cacheKeyPrefix
 

Detailed Description

SiteLinkLookup implementation that caches the obtained data (except for data obtained via "getLinks").

Note: This doesn't implement any means of purging or data invalidation beyond the cache timeout.

Author
Marius Hoch < hoo@o.nosp@m.nlin.nosp@m.e.de >

Constructor & Destructor Documentation

◆ __construct()

Wikibase\Lib\Store\CachingSiteLinkLookup::__construct ( SiteLinkLookup  $siteLinkLookup,
BagOStuff  $cache,
  $cacheDuration = 3600,
  $cacheKeyPrefix = 'wikibase' 
)
Parameters
SiteLinkLookup$siteLinkLookupThe lookup to use
BagOStuff$cacheThe cache to use
int$cacheDurationCache duration in seconds. Defaults to 3600 (1 hour).
string$cacheKeyPrefixCache key prefix to use. Important in case we're not in-process caching. Defaults to "wikibase"

Member Function Documentation

◆ getAndCacheItemIdForLink()

Wikibase\Lib\Store\CachingSiteLinkLookup::getAndCacheItemIdForLink ( string  $globalSiteId,
string  $pageTitle 
)
private

◆ getByPageCacheKey()

Wikibase\Lib\Store\CachingSiteLinkLookup::getByPageCacheKey ( string  $globalSiteId,
string  $pageTitle 
)
private

◆ getItemIdForLink()

Wikibase\Lib\Store\CachingSiteLinkLookup::getItemIdForLink ( string  $globalSiteId,
string  $pageTitle 
)

Returns the id of the item that is equivalent to the provided page, or null if there is none.

Implements Wikibase\Lib\Store\SiteLinkLookup.

◆ getItemIdForSiteLink()

Wikibase\Lib\Store\CachingSiteLinkLookup::getItemIdForSiteLink ( SiteLink  $siteLink)

◆ getLinks()

Wikibase\Lib\Store\CachingSiteLinkLookup::getLinks ( ?array  $numericIds = null,
?array  $siteIds = null,
?array  $pageNames = null 
)

This is uncached!

Implements Wikibase\Lib\Store\SiteLinkLookup.

◆ getSiteLinksForItem()

Wikibase\Lib\Store\CachingSiteLinkLookup::getSiteLinksForItem ( ItemId  $itemId)

Returns an array of SiteLink objects for an item.

If the item isn't known or not an Item, an empty array is returned.

Parameters
ItemId$itemId
Returns
SiteLink[]

Implements Wikibase\Lib\Store\SiteLinkLookup.

Member Data Documentation

◆ $cache

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

◆ $cacheDuration

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

◆ $cacheKeyPrefix

Wikibase\Lib\Store\CachingSiteLinkLookup::$cacheKeyPrefix
private

◆ $lookup

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

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