MediaWiki master
BacklinkCacheFactory.php
Go to the documentation of this file.
1<?php
24namespace MediaWiki\Cache;
25
26use BacklinkCache;
33
39 private $latestBacklinkCache;
40
42 private $wanCache;
43
45 private $hookContainer;
46
47 private IConnectionProvider $dbProvider;
48 private ServiceOptions $options;
49 private LinksMigration $linksMigration;
50
51 public function __construct(
52 ServiceOptions $options,
53 LinksMigration $linksMigration,
54 WANObjectCache $wanCache,
55 HookContainer $hookContainer,
56 IConnectionProvider $dbProvider
57 ) {
58 $this->options = $options;
59 $this->linksMigration = $linksMigration;
60 $this->wanCache = $wanCache;
61 $this->hookContainer = $hookContainer;
62 $this->dbProvider = $dbProvider;
63 }
64
75 public function getBacklinkCache( PageReference $page ): BacklinkCache {
76 if ( !$this->latestBacklinkCache || !$this->latestBacklinkCache->getPage()->isSamePageAs( $page ) ) {
77 $this->latestBacklinkCache = new BacklinkCache(
78 $this->options,
79 $this->linksMigration,
80 $this->wanCache,
81 $this->hookContainer,
82 $this->dbProvider,
83 $page
84 );
85 }
86 return $this->latestBacklinkCache;
87 }
88}
if(!defined('MW_SETUP_CALLBACK'))
Definition WebStart.php:81
__construct(ServiceOptions $options, LinksMigration $linksMigration, WANObjectCache $wanCache, HookContainer $hookContainer, IConnectionProvider $dbProvider)
getBacklinkCache(PageReference $page)
Returns a BacklinkCache for $page.
Class for fetching backlink lists, approximate backlink counts and partitions.
A class for passing options to services.
Service for compat reading of links tables.
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.