MediaWiki
master
|
Cache for ParserOutput objects. More...
Public Member Functions | |
__construct (string $name, WANObjectCache $cache, int $cacheExpiry, string $cacheEpoch, JsonCodec $jsonCodec, IBufferingStatsdDataFactory $stats, LoggerInterface $logger) | |
get (RevisionRecord $revision, ParserOptions $parserOptions) | |
Retrieve the ParserOutput from cache. More... | |
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. More... | |
save (ParserOutput $output, RevisionRecord $revision, ParserOptions $parserOptions, string $cacheTime=null) | |
Private Member Functions | |
encodeAsJson (CacheTime $obj, string $key) | |
incrementStats (RevisionRecord $revision, string $metricSuffix) | |
restoreFromJson (string $jsonData, string $key, string $expectedClass) | |
Private Attributes | |
WANObjectCache | $cache |
string | $cacheEpoch |
Anything cached prior to this is invalidated. More... | |
string | $cacheExpiry |
Expiry time for cache entries. More... | |
JsonCodec | $jsonCodec |
LoggerInterface | $logger |
string | $name |
The name of this cache. More... | |
IBufferingStatsdDataFactory | $stats |
Cache for ParserOutput objects.
The cache is split per ParserOptions.
Definition at line 44 of file RevisionOutputCache.php.
Parser\RevisionOutputCache::__construct | ( | string | $name, |
WANObjectCache | $cache, | ||
int | $cacheExpiry, | ||
string | $cacheEpoch, | ||
JsonCodec | $jsonCodec, | ||
IBufferingStatsdDataFactory | $stats, | ||
LoggerInterface | $logger | ||
) |
string | $name | |
WANObjectCache | $cache | |
int | $cacheExpiry | Expiry for ParserOutput in $cache. |
string | $cacheEpoch | Anything before this timestamp is invalidated |
JsonCodec | $jsonCodec | |
IBufferingStatsdDataFactory | $stats | |
LoggerInterface | $logger |
Definition at line 84 of file RevisionOutputCache.php.
References Parser\RevisionOutputCache\$cache, Parser\RevisionOutputCache\$cacheEpoch, Parser\RevisionOutputCache\$cacheExpiry, Parser\RevisionOutputCache\$jsonCodec, Parser\RevisionOutputCache\$logger, Parser\RevisionOutputCache\$name, and Parser\RevisionOutputCache\$stats.
|
private |
CacheTime | $obj | |
string | $key |
Definition at line 272 of file RevisionOutputCache.php.
Referenced by Parser\RevisionOutputCache\save().
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 148 of file RevisionOutputCache.php.
References Parser\RevisionOutputCache\incrementStats(), Parser\RevisionOutputCache\makeParserOutputKey(), and Parser\RevisionOutputCache\restoreFromJson().
|
private |
RevisionRecord | $revision | |
string | $metricSuffix |
Definition at line 106 of file RevisionOutputCache.php.
Referenced by Parser\RevisionOutputCache\get(), and Parser\RevisionOutputCache\save().
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.
RevisionRecord | $revision | |
ParserOptions | $options | |
array | null | $usedOptions | currently ignored |
Definition at line 126 of file RevisionOutputCache.php.
References ParserOptions\allCacheVaryingOptions(), and ParserOptions\optionsHash().
Referenced by Parser\RevisionOutputCache\get(), and Parser\RevisionOutputCache\save().
|
private |
string | $jsonData | |
string | $key | |
string | $expectedClass |
Definition at line 252 of file RevisionOutputCache.php.
Referenced by Parser\RevisionOutputCache\get().
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 193 of file RevisionOutputCache.php.
References ParserOutput\addCacheMessage(), Parser\RevisionOutputCache\encodeAsJson(), CacheTime\getCacheExpiry(), ParserOutput\hasText(), Parser\RevisionOutputCache\incrementStats(), ParserOptions\isSafeToCache(), Parser\RevisionOutputCache\makeParserOutputKey(), CacheTime\setCacheRevisionId(), CacheTime\setCacheTime(), ParserOutput\setTimestamp(), CacheTime\updateCacheExpiry(), and wfTimestampNow().
|
private |
Definition at line 50 of file RevisionOutputCache.php.
Referenced by Parser\RevisionOutputCache\__construct().
|
private |
Anything cached prior to this is invalidated.
Definition at line 57 of file RevisionOutputCache.php.
Referenced by Parser\RevisionOutputCache\__construct().
|
private |
Expiry time for cache entries.
Definition at line 64 of file RevisionOutputCache.php.
Referenced by Parser\RevisionOutputCache\__construct().
|
private |
Definition at line 67 of file RevisionOutputCache.php.
Referenced by Parser\RevisionOutputCache\__construct().
|
private |
Definition at line 73 of file RevisionOutputCache.php.
Referenced by Parser\RevisionOutputCache\__construct().
|
private |
The name of this cache.
Used as a root of the cache key.
Definition at line 47 of file RevisionOutputCache.php.
Referenced by Parser\RevisionOutputCache\__construct().
|
private |
Definition at line 70 of file RevisionOutputCache.php.
Referenced by Parser\RevisionOutputCache\__construct().