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 ( $globalSiteId, $pageTitle)
 
 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 ( $globalSiteId, $pageTitle)
 
 getAndCacheItemIdForLink ( $globalSiteId, $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 (   $globalSiteId,
  $pageTitle 
)
private
Parameters
string$globalSiteId
string$pageTitle
Returns
ItemId|null

◆ getByPageCacheKey()

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

◆ getItemIdForLink()

Wikibase\Lib\Store\CachingSiteLinkLookup::getItemIdForLink (   $globalSiteId,
  $pageTitle 
)
See also
SiteLinkLookup::getItemIdForLink
Parameters
string$globalSiteId
string$pageTitle
Returns
ItemId|null

Implements Wikibase\Lib\Store\SiteLinkLookup.

◆ getItemIdForSiteLink()

Wikibase\Lib\Store\CachingSiteLinkLookup::getItemIdForSiteLink ( SiteLink  $siteLink)
See also
SiteLinkLookup::getItemIdForSiteLink
Parameters
SiteLink$siteLink
Returns
ItemId|null

Implements Wikibase\Lib\Store\SiteLinkLookup.

◆ 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: