MediaWiki
master
|
Parser cache specific expiry check. More...
Public Member Functions | |
__wakeup () | |
expired ( $touched) | |
Return true if this cached output object predates the global or per-article cache invalidation timestamps, or if it comes from an incompatible older version. More... | |
getCacheExpiry () | |
Returns the number of seconds after which this object should expire. More... | |
getCacheRevisionId () | |
getCacheTime () | |
getUsedOptions () | |
Returns the options from its ParserOptions which have been taken into account to produce the output. More... | |
isCacheable () | |
isDifferentRevision ( $id) | |
Return true if this cached output object is for a different revision of the page. More... | |
recordOption (string $option) | |
Tags a parser option for use in the cache key for this parser output. More... | |
recordOptions (array $options) | |
Tags a list of parser option names for use in the cache key for this parser output. More... | |
setCacheRevisionId ( $id) | |
setCacheTime ( $t) | |
setCacheTime() sets the timestamp expressing when the page has been rendered. More... | |
updateCacheExpiry ( $seconds) | |
Sets the number of seconds after which this object should expire. More... | |
Static Public Member Functions | |
static | newFromJsonArray (JsonUnserializer $unserializer, array $json) |
Creates a new instance of the class and initialized it from the $json array. More... | |
Public Attributes | |
int null | $mCacheExpiry = null |
Seconds after which the object should expire, use 0 for not cacheable. More... | |
int null | $mCacheRevisionId = null |
Revision ID that was parsed. More... | |
string int | $mCacheTime = '' |
TS_MW timestamp when this object was generated, or -1 for not cacheable. More... | |
Protected Member Functions | |
initFromJson (JsonUnserializer $unserializer, array $jsonData) | |
Initialize member fields from an array returned by jsonSerialize(). More... | |
toJsonArray () | |
Returns a JSON serializable structure representing this CacheTime instance. More... | |
Protected Attributes | |
true[] | $mParseUsedOptions = [] |
ParserOptions which have been taken into account to produce output, option names stored in array keys. More... | |
Parser cache specific expiry check.
Definition at line 35 of file CacheTime.php.
CacheTime::__wakeup | ( | ) |
Reimplemented in ParserOutput.
Definition at line 284 of file CacheTime.php.
References recordOptions().
CacheTime::expired | ( | $touched | ) |
Return true if this cached output object predates the global or per-article cache invalidation timestamps, or if it comes from an incompatible older version.
string | $touched | The affected article's last touched timestamp |
Definition at line 176 of file CacheTime.php.
References $wgCacheEpoch, getCacheExpiry(), getCacheTime(), and isCacheable().
CacheTime::getCacheExpiry | ( | ) |
Returns the number of seconds after which this object should expire.
This method is used by ParserCache to determine how long the ParserOutput can be cached. The timestamp of expiry can be calculated by adding getCacheExpiry() to getCacheTime(). The value returned by getCacheExpiry is smaller or equal to the smallest number that was provided to a call of updateCacheExpiry(), and smaller or equal to the value of $wgParserCacheExpireTime.
Implements Parser\ParserCacheMetadata.
Definition at line 138 of file CacheTime.php.
References $mCacheExpiry, and $wgParserCacheExpireTime.
Referenced by expired(), ParserOutput\hasDynamicContent(), isCacheable(), Parser\RevisionOutputCache\save(), ParserCache\save(), MediaWiki\Storage\PageEditStash\storeStashValue(), and WikiPage\triggerOpportunisticLinksUpdate().
CacheTime::getCacheRevisionId | ( | ) |
Implements Parser\ParserCacheMetadata.
Definition at line 96 of file CacheTime.php.
References $mCacheRevisionId.
Referenced by ParserCache\checkOutdated(), Article\doOutputFromParserCache(), and isDifferentRevision().
CacheTime::getCacheTime | ( | ) |
Implements Parser\ParserCacheMetadata.
Definition at line 65 of file CacheTime.php.
References $mCacheTime.
Referenced by ParserCache\checkExpired(), expired(), MediaWiki\Storage\PageEditStash\storeStashValue(), and WikiPage\triggerOpportunisticLinksUpdate().
CacheTime::getUsedOptions | ( | ) |
Returns the options from its ParserOptions which have been taken into account to produce the output.
Implements Parser\ParserCacheMetadata.
Definition at line 210 of file CacheTime.php.
Referenced by ParserCache\save().
|
protected |
Initialize member fields from an array returned by jsonSerialize().
JsonUnserializer | $unserializer | |
array | $jsonData |
Reimplemented in ParserOutput.
Definition at line 269 of file CacheTime.php.
References recordOptions().
CacheTime::isCacheable | ( | ) |
Definition at line 164 of file CacheTime.php.
References getCacheExpiry().
Referenced by OutputPage\addParserOutputMetadata(), and expired().
CacheTime::isDifferentRevision | ( | $id | ) |
Return true if this cached output object is for a different revision of the page.
int | $id | The affected article's current revision id |
Definition at line 199 of file CacheTime.php.
References getCacheRevisionId().
|
static |
Creates a new instance of the class and initialized it from the $json array.
JsonUnserializer | $unserializer | an instance of JsonUnserializer to use for nested properties if they need special care. |
array | $json |
Implements MediaWiki\Json\JsonUnserializable.
Reimplemented in ParserOutput.
Definition at line 258 of file CacheTime.php.
CacheTime::recordOption | ( | string | $option | ) |
Tags a parser option for use in the cache key for this parser output.
Registered as a watcher at ParserOptions::registerWatcher() by Parser::clearState(). The information gathered here is available via getUsedOptions(), and is used by ParserCache::save().
string | $option |
Definition at line 226 of file CacheTime.php.
CacheTime::recordOptions | ( | array | $options | ) |
Tags a list of parser option names for use in the cache key for this parser output.
string[] | $options |
Definition at line 236 of file CacheTime.php.
Referenced by __wakeup(), initFromJson(), and ParserCache\save().
CacheTime::setCacheRevisionId | ( | $id | ) |
int | null | $id | Revision ID |
Definition at line 104 of file CacheTime.php.
Referenced by Parser\RevisionOutputCache\save(), and ParserCache\save().
CacheTime::setCacheTime | ( | $t | ) |
setCacheTime() sets the timestamp expressing when the page has been rendered.
This does not control expiry, see updateCacheExpiry() for that!
string | $t | TS_MW timestamp |
Definition at line 79 of file CacheTime.php.
References $t, wfDeprecatedMsg(), and wfSetVar().
Referenced by Parser\RevisionOutputCache\save(), and ParserCache\save().
|
protected |
Returns a JSON serializable structure representing this CacheTime instance.
Reimplemented in ParserOutput.
Definition at line 249 of file CacheTime.php.
References $mCacheExpiry, $mCacheRevisionId, $mCacheTime, and $mParseUsedOptions.
CacheTime::updateCacheExpiry | ( | $seconds | ) |
Sets the number of seconds after which this object should expire.
This value is used with the ParserCache. If called with a value greater than the value provided at any previous call, the new call has no effect. The value returned by getCacheExpiry is smaller or equal to the smallest number that was provided as an argument to updateCacheExpiry().
Avoid using 0 if at all possible. Consider JavaScript for highly dynamic content.
int | $seconds |
Definition at line 121 of file CacheTime.php.
Referenced by ParserOutput\finalizeAdaptiveCacheExpiry(), Parser\RevisionOutputCache\save(), and ParserOutput\updateRuntimeAdaptiveExpiry().
int null CacheTime::$mCacheExpiry = null |
Seconds after which the object should expire, use 0 for not cacheable.
Used in ParserCache.
Definition at line 55 of file CacheTime.php.
Referenced by getCacheExpiry(), and toJsonArray().
int null CacheTime::$mCacheRevisionId = null |
Revision ID that was parsed.
Definition at line 60 of file CacheTime.php.
Referenced by getCacheRevisionId(), and toJsonArray().
string int CacheTime::$mCacheTime = '' |
TS_MW timestamp when this object was generated, or -1 for not cacheable.
Used in ParserCache.
Definition at line 49 of file CacheTime.php.
Referenced by getCacheTime(), and toJsonArray().
|
protected |
ParserOptions which have been taken into account to produce output, option names stored in array keys.
Definition at line 43 of file CacheTime.php.
Referenced by toJsonArray().