MediaWiki master
BacklinkCacheFactory.php
Go to the documentation of this file.
1<?php
24namespace MediaWiki\Cache;
25
30use Psr\Log\LoggerInterface;
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 private LoggerInterface $logger;
51
52 public function __construct(
53 ServiceOptions $options,
54 LinksMigration $linksMigration,
55 WANObjectCache $wanCache,
56 HookContainer $hookContainer,
57 IConnectionProvider $dbProvider,
58 LoggerInterface $logger
59 ) {
60 $this->options = $options;
61 $this->linksMigration = $linksMigration;
62 $this->wanCache = $wanCache;
63 $this->hookContainer = $hookContainer;
64 $this->dbProvider = $dbProvider;
65 $this->logger = $logger;
66 }
67
78 public function getBacklinkCache( PageReference $page ): BacklinkCache {
79 if ( !$this->latestBacklinkCache || !$this->latestBacklinkCache->getPage()->isSamePageAs( $page ) ) {
80 $this->latestBacklinkCache = new BacklinkCache(
81 $this->options,
82 $this->linksMigration,
83 $this->wanCache,
84 $this->hookContainer,
85 $this->dbProvider,
86 $this->logger,
87 $page
88 );
89 }
90 return $this->latestBacklinkCache;
91 }
92}
if(!defined('MW_SETUP_CALLBACK'))
Definition WebStart.php:81
__construct(ServiceOptions $options, LinksMigration $linksMigration, WANObjectCache $wanCache, HookContainer $hookContainer, IConnectionProvider $dbProvider, LoggerInterface $logger)
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.