|
MediaWiki master
|
Cache for ParserOutput objects. More...
Public Member Functions | |
| __construct (string $name, private readonly WANObjectCache $cache, int $cacheExpiry, string $cacheEpoch, private readonly JsonCodec $jsonCodec, private readonly StatsFactory $stats, private readonly LoggerInterface $logger, private readonly 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) | |
Cache for ParserOutput objects.
The cache is split per ParserOptions.
Definition at line 31 of file RevisionOutputCache.php.
| MediaWiki\Parser\RevisionOutputCache::__construct | ( | string | $name, |
| private readonly WANObjectCache | $cache, | ||
| int | $cacheExpiry, | ||
| string | $cacheEpoch, | ||
| private readonly JsonCodec | $jsonCodec, | ||
| private readonly StatsFactory | $stats, | ||
| private readonly LoggerInterface | $logger, | ||
| private readonly GlobalIdGenerator | $globalIdGenerator ) |
| string | $name | |
| WANObjectCache | $cache | |
| int | $cacheExpiry | Expiry for ParserOutput in $cache. |
| string | $cacheEpoch | Anything before this timestamp is invalidated |
| JsonCodec | $jsonCodec | |
| StatsFactory | $stats | |
| LoggerInterface | $logger | |
| GlobalIdGenerator | $globalIdGenerator |
Definition at line 60 of file RevisionOutputCache.php.
| MediaWiki\Parser\RevisionOutputCache::get | ( | RevisionRecord | $revision, |
| ParserOptions | $parserOptions ) |
Retrieve the ParserOutput from cache.
false if not found or outdated.
| RevisionRecord | $revision | |
| ParserOptions | $parserOptions |
Definition at line 190 of file RevisionOutputCache.php.
| 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.
| RevisionRecord | $revision | |
| ParserOptions | $options | |
| array | null | $usedOptions | currently ignored |
Definition at line 135 of file RevisionOutputCache.php.
| 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.
| RevisionRecord | $revision | |
| ParserOptions | $options | |
| array | null | $usedOptions | currently ignored |
Definition at line 168 of file RevisionOutputCache.php.
| MediaWiki\Parser\RevisionOutputCache::save | ( | ParserOutput | $output, |
| RevisionRecord | $revision, | ||
| ParserOptions | $parserOptions, | ||
| ?string | $cacheTime = null ) |
| ParserOutput | $output | |
| RevisionRecord | $revision | |
| ParserOptions | $parserOptions | |
| string | null | $cacheTime | TS::MW timestamp when the output was generated |
Definition at line 235 of file RevisionOutputCache.php.
References MediaWiki\Parser\ParserOutput\addCacheMessage(), MediaWiki\Parser\ParserOutput\getCacheExpiry(), MediaWiki\Parser\CacheTime\getCacheRevisionId(), MediaWiki\Parser\CacheTime\getCacheTime(), MediaWiki\Revision\RevisionRecord\getId(), MediaWiki\Parser\ParserOutput\getRenderId(), MediaWiki\Parser\ParserOptions\getRenderReason(), MediaWiki\Parser\ParserOutput\getRevisionTimestamp(), MediaWiki\Revision\RevisionRecord\getTimestamp(), MediaWiki\Parser\ParserOutput\hasText(), MediaWiki\Parser\ParserOptions\isSafeToCache(), MediaWiki\Parser\CacheTime\setCacheRevisionId(), MediaWiki\Parser\CacheTime\setCacheTime(), MediaWiki\Parser\ParserOutput\setRenderId(), MediaWiki\Parser\ParserOutput\setRevisionTimestamp(), and MediaWiki\Parser\CacheTime\updateCacheExpiry().