MediaWiki master
MediaWiki\Parser\RevisionOutputCache Class Reference

Cache for ParserOutput objects. More...

Public Member Functions

 __construct (string $name, WANObjectCache $cache, int $cacheExpiry, string $cacheEpoch, JsonCodec $jsonCodec, StatsFactory $stats, LoggerInterface $logger, GlobalIdGenerator $globalIdGenerator)
 
 get (RevisionRecord $revision, ParserOptions $parserOptions)
 Retrieve the ParserOutput from cache.
 
 makeParserOutputKey (RevisionRecord $revision, ParserOptions $options, array $usedOptions=null)
 Get a key that will be used by this cache to store the content for a given page considering the given options and the array of used options.
 
 makeParserOutputKeyOptionalRevId (RevisionRecord $revision, ParserOptions $options, array $usedOptions=null)
 Get a key that will be used for locks or pool counter.
 
 save (ParserOutput $output, RevisionRecord $revision, ParserOptions $parserOptions, string $cacheTime=null)
 

Detailed Description

Cache for ParserOutput objects.

The cache is split per ParserOptions.

Since
1.36

Definition at line 45 of file RevisionOutputCache.php.

Constructor & Destructor Documentation

◆ __construct()

MediaWiki\Parser\RevisionOutputCache::__construct ( string $name,
WANObjectCache $cache,
int $cacheExpiry,
string $cacheEpoch,
JsonCodec $jsonCodec,
StatsFactory $stats,
LoggerInterface $logger,
GlobalIdGenerator $globalIdGenerator )
Parameters
string$name
WANObjectCache$cache
int$cacheExpiryExpiry for ParserOutput in $cache.
string$cacheEpochAnything before this timestamp is invalidated
JsonCodec$jsonCodec
StatsFactory$stats
LoggerInterface$logger
GlobalIdGenerator$globalIdGenerator

Definition at line 88 of file RevisionOutputCache.php.

Member Function Documentation

◆ get()

MediaWiki\Parser\RevisionOutputCache::get ( RevisionRecord $revision,
ParserOptions $parserOptions )

Retrieve the ParserOutput from cache.

false if not found or outdated.

Parameters
RevisionRecord$revision
ParserOptions$parserOptions
Returns
ParserOutput|false False on failure

Definition at line 196 of file RevisionOutputCache.php.

◆ makeParserOutputKey()

MediaWiki\Parser\RevisionOutputCache::makeParserOutputKey ( RevisionRecord $revision,
ParserOptions $options,
array $usedOptions = null )

Get a key that will be used by this cache to store the content for a given page considering the given options and the array of used options.

If there is a possibility the revision does not have a revision id, use makeParserOutputKeyOptionalRevId() instead.

Warning
The exact format of the key is considered internal and is subject to change, thus should not be used as storage or long-term caching key. This is intended to be used for logging or keying something transient.
Parameters
RevisionRecord$revision
ParserOptions$options
array | null$usedOptionscurrently ignored
Returns
string
Access: internal

Definition at line 141 of file RevisionOutputCache.php.

◆ makeParserOutputKeyOptionalRevId()

MediaWiki\Parser\RevisionOutputCache::makeParserOutputKeyOptionalRevId ( RevisionRecord $revision,
ParserOptions $options,
array $usedOptions = null )

Get a key that will be used for locks or pool counter.

Similar to makeParserOutputKey except the revision id might be null, in which case it is unsafe to cache, but still needs a key for things like poolcounter.

Warning
The exact format of the key is considered internal and is subject to change, thus should not be used as storage or long-term caching key. This is intended to be used for logging or keying something transient.
Parameters
RevisionRecord$revision
ParserOptions$options
array | null$usedOptionscurrently ignored
Returns
string
Access: internal

Definition at line 174 of file RevisionOutputCache.php.

◆ save()


The documentation for this class was generated from the following file: