MediaWiki  master
BacklinkCacheFactory.php
Go to the documentation of this file.
1 <?php
24 namespace MediaWiki\Cache;
25 
26 use BacklinkCache;
28 use WANObjectCache;
29 
36 
38  private $wanCache;
39 
43  public function __construct( WANObjectCache $wanCache ) {
44  $this->wanCache = $wanCache;
45  }
46 
57  public function getBacklinkCache( PageReference $page ): BacklinkCache {
58  if ( !$this->latestBacklinkCache || !$this->latestBacklinkCache->getPage()->isSamePageAs( $page ) ) {
59  $this->latestBacklinkCache = new BacklinkCache( $this->wanCache, $page );
60  }
62  }
63 }
MediaWiki\Cache
Definition: BacklinkCacheFactory.php:24
MediaWiki\Cache\BacklinkCacheFactory\getBacklinkCache
getBacklinkCache(PageReference $page)
Returns a BacklinkCache for $page.
Definition: BacklinkCacheFactory.php:57
BacklinkCache
Class for fetching backlink lists, approximate backlink counts and partitions.
Definition: BacklinkCache.php:50
Page\PageReference
Interface for objects (potentially) representing a page that can be viewable and linked to on a wiki.
Definition: PageReference.php:49
MediaWiki\Cache\BacklinkCacheFactory\__construct
__construct(WANObjectCache $wanCache)
Definition: BacklinkCacheFactory.php:43
WANObjectCache
Multi-datacenter aware caching interface.
Definition: WANObjectCache.php:131
MediaWiki\Cache\BacklinkCacheFactory\$wanCache
WANObjectCache $wanCache
Definition: BacklinkCacheFactory.php:38
MediaWiki\Cache\BacklinkCacheFactory
Definition: BacklinkCacheFactory.php:33
MediaWiki\Cache\BacklinkCacheFactory\$latestBacklinkCache
BacklinkCache $latestBacklinkCache
Definition: BacklinkCacheFactory.php:35