parserCacheBackend = $parserCacheBackend; $this->revisionOutputCacheBackend = $revisionOutputCacheBackend; $this->hookContainer = $hookContainer; $this->jsonCodec = $jsonCodec; $this->stats = $stats; $this->logger = $logger; $options->assertRequiredOptions( self::CONSTRUCTOR_OPTIONS ); $this->options = $options; $this->titleFactory = $titleFactory; $this->wikiPageFactory = $wikiPageFactory; $this->globalIdGenerator = $globalIdGenerator; } /** * Get a ParserCache instance by $name. * @param string $name * @return ParserCache */ public function getParserCache( string $name ): ParserCache { if ( !isset( $this->parserCaches[$name] ) ) { $this->logger->debug( "Creating ParserCache instance for {$name}" ); $cache = new ParserCache( $name, $this->parserCacheBackend, $this->options->get( MainConfigNames::CacheEpoch ), $this->hookContainer, $this->jsonCodec, $this->stats, $this->logger, $this->titleFactory, $this->wikiPageFactory, $this->globalIdGenerator ); $filterConfig = $this->options->get( MainConfigNames::ParserCacheFilterConfig ); if ( isset( $filterConfig[$name] ) ) { $filter = new ParserCacheFilter( $filterConfig[$name] ); $cache->setFilter( $filter ); } $this->parserCaches[$name] = $cache; } return $this->parserCaches[$name]; } /** * Get a RevisionOutputCache instance by $name. * @param string $name * @return RevisionOutputCache */ public function getRevisionOutputCache( string $name ): RevisionOutputCache { if ( !isset( $this->revisionOutputCaches[$name] ) ) { $this->logger->debug( "Creating RevisionOutputCache instance for {$name}" ); $cache = new RevisionOutputCache( $name, $this->revisionOutputCacheBackend, $this->options->get( MainConfigNames::OldRevisionParserCacheExpireTime ), $this->options->get( MainConfigNames::CacheEpoch ), $this->jsonCodec, $this->stats, $this->logger, $this->globalIdGenerator ); $this->revisionOutputCaches[$name] = $cache; } return $this->revisionOutputCaches[$name]; } }