MediaWiki  master
BacklinkCacheFactory.php
Go to the documentation of this file.
1 <?php
24 namespace MediaWiki\Cache;
25 
26 use BacklinkCache;
29 use WANObjectCache;
31 
37  private $latestBacklinkCache;
38 
40  private $wanCache;
41 
43  private $hookContainer;
44 
45  private IConnectionProvider $dbProvider;
46 
51  public function __construct(
52  WANObjectCache $wanCache,
53  HookContainer $hookContainer,
54  IConnectionProvider $dbProvider
55  ) {
56  $this->wanCache = $wanCache;
57  $this->hookContainer = $hookContainer;
58  $this->dbProvider = $dbProvider;
59  }
60 
71  public function getBacklinkCache( PageReference $page ): BacklinkCache {
72  if ( !$this->latestBacklinkCache || !$this->latestBacklinkCache->getPage()->isSamePageAs( $page ) ) {
73  $this->latestBacklinkCache = new BacklinkCache(
74  $this->wanCache,
75  $this->hookContainer,
76  $this->dbProvider,
77  $page
78  );
79  }
80  return $this->latestBacklinkCache;
81  }
82 }
if(!defined('MW_SETUP_CALLBACK'))
Definition: WebStart.php:88
Class for fetching backlink lists, approximate backlink counts and partitions.
__construct(WANObjectCache $wanCache, HookContainer $hookContainer, IConnectionProvider $dbProvider)
getBacklinkCache(PageReference $page)
Returns a BacklinkCache for $page.
Multi-datacenter aware caching interface.
Interface for objects (potentially) representing a page that can be viewable and linked to on a wiki.
Provide primary and replica IDatabase connections.