MediaWiki master
|
Parser cache specific expiry check. More...
Inherits MediaWiki\Parser\ParserCacheMetadata, and MediaWiki\Json\JsonDeserializable.
Inherited by MediaWiki\Parser\ParserOutput.
Public Member Functions | |
__get ( $name) | |
__set ( $name, $value) | |
__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. | |
getCacheExpiry () | |
Returns the number of seconds after which this object should expire. | |
getCacheRevisionId () | |
getCacheTime () | |
getUsedOptions () | |
Returns the options from its ParserOptions which have been taken into account to produce the output. | |
hasCacheTime () | |
isCacheable () | |
isDifferentRevision ( $id) | |
Return true if this cached output object is for a different revision of the page. | |
recordOption (string $option) | |
Tags a parser option for use in the cache key for this parser output. | |
recordOptions (array $options) | |
Tags a list of parser option names for use in the cache key for this parser output. | |
setCacheRevisionId ( $id) | |
setCacheTime ( $t) | |
setCacheTime() sets the timestamp expressing when the page has been rendered. | |
updateCacheExpiry ( $seconds) | |
Sets the number of seconds after which this object should expire. | |
Static Public Member Functions | |
static | newFromJsonArray (JsonDeserializer $deserializer, array $json) |
Creates a new instance of the class and initialized it from the $json array. | |
Protected Member Functions | |
initFromJson (JsonDeserializer $deserializer, array $jsonData) | |
Initialize member fields from an array returned by jsonSerialize(). | |
toJsonArray () | |
Returns a JSON serializable structure representing this CacheTime instance. | |
Protected Attributes | |
int null | $mCacheExpiry = null |
Seconds after which the object should expire, use 0 for not cacheable. | |
int null | $mCacheRevisionId = null |
Revision ID that was parsed. | |
string int | $mCacheTime = '' |
TS_MW timestamp when this object was generated, or -1 for not cacheable. | |
true[] | $mParseUsedOptions = [] |
ParserOptions which have been taken into account to produce output, option names stored in array keys. | |
Parser cache specific expiry check.
Definition at line 39 of file CacheTime.php.
MediaWiki\Parser\CacheTime::__get | ( | $name | ) |
Reimplemented in MediaWiki\Parser\ParserOutput.
Definition at line 303 of file CacheTime.php.
References wfDeprecatedMsg().
MediaWiki\Parser\CacheTime::__set | ( | $name, | |
$value ) |
Reimplemented in MediaWiki\Parser\ParserOutput.
Definition at line 318 of file CacheTime.php.
References wfDeprecatedMsg().
MediaWiki\Parser\CacheTime::__wakeup | ( | ) |
Reimplemented in MediaWiki\Parser\ParserOutput.
Definition at line 295 of file CacheTime.php.
MediaWiki\Parser\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 181 of file CacheTime.php.
MediaWiki\Parser\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 MediaWiki\Parser\ParserCacheMetadata.
Definition at line 153 of file CacheTime.php.
Referenced by MediaWiki\Parser\Parser\makeLimitReport(), MediaWiki\Parser\RevisionOutputCache\save(), MediaWiki\Parser\ParserCache\save(), and WikiPage\triggerOpportunisticLinksUpdate().
MediaWiki\Parser\CacheTime::getCacheRevisionId | ( | ) |
Implements MediaWiki\Parser\ParserCacheMetadata.
Definition at line 107 of file CacheTime.php.
Referenced by MediaWiki\Parser\RevisionOutputCache\save(), and MediaWiki\Parser\ParserCache\save().
MediaWiki\Parser\CacheTime::getCacheTime | ( | ) |
Implements MediaWiki\Parser\ParserCacheMetadata.
Definition at line 69 of file CacheTime.php.
References MediaWiki\Parser\CacheTime\$mCacheTime.
Referenced by MediaWiki\Parser\Parser\makeLimitReport(), MediaWiki\Parser\RevisionOutputCache\save(), MediaWiki\Parser\ParserCache\save(), and WikiPage\triggerOpportunisticLinksUpdate().
MediaWiki\Parser\CacheTime::getUsedOptions | ( | ) |
Returns the options from its ParserOptions which have been taken into account to produce the output.
Implements MediaWiki\Parser\ParserCacheMetadata.
Definition at line 215 of file CacheTime.php.
Referenced by MediaWiki\Parser\ParserObserver\notifyParse(), and MediaWiki\Parser\ParserCache\save().
MediaWiki\Parser\CacheTime::hasCacheTime | ( | ) |
Definition at line 80 of file CacheTime.php.
Referenced by MediaWiki\Parser\ParserCache\save().
|
protected |
Initialize member fields from an array returned by jsonSerialize().
JsonDeserializer | $deserializer | Unused |
array | $jsonData |
Reimplemented in MediaWiki\Parser\ParserOutput.
Definition at line 277 of file CacheTime.php.
MediaWiki\Parser\CacheTime::isCacheable | ( | ) |
Definition at line 169 of file CacheTime.php.
Referenced by MediaWiki\Output\OutputPage\addParserOutputMetadata().
MediaWiki\Parser\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 204 of file CacheTime.php.
|
static |
Creates a new instance of the class and initialized it from the $json array.
JsonDeserializer | $deserializer | an instance of JsonDeserializer to use for nested properties if they need special care. |
array | $json |
Implements MediaWiki\Json\JsonDeserializable.
Reimplemented in MediaWiki\Parser\ParserOutput.
Definition at line 266 of file CacheTime.php.
MediaWiki\Parser\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 231 of file CacheTime.php.
MediaWiki\Parser\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 241 of file CacheTime.php.
Referenced by MediaWiki\Parser\ParserCache\save().
MediaWiki\Parser\CacheTime::setCacheRevisionId | ( | $id | ) |
int | null | $id | Revision ID |
Definition at line 115 of file CacheTime.php.
Referenced by MediaWiki\Parser\RevisionOutputCache\save(), and MediaWiki\Parser\ParserCache\save().
MediaWiki\Parser\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 90 of file CacheTime.php.
References wfDeprecatedMsg(), and wfSetVar().
Referenced by MediaWiki\Parser\RevisionOutputCache\save(), and MediaWiki\Parser\ParserCache\save().
|
protected |
Returns a JSON serializable structure representing this CacheTime instance.
Reimplemented in MediaWiki\Parser\ParserOutput.
Definition at line 254 of file CacheTime.php.
MediaWiki\Parser\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.
NOTE: Beware that reducing the TTL for reasons that do not relate to "dynamic content", may have the side-effect of incurring more RefreshLinksJob executions. See also WikiPage::triggerOpportunisticLinksUpdate.
int | $seconds |
Definition at line 136 of file CacheTime.php.
Referenced by MediaWiki\Parser\RevisionOutputCache\save().
|
protected |
Seconds after which the object should expire, use 0 for not cacheable.
Used in ParserCache.
Definition at line 59 of file CacheTime.php.
|
protected |
Revision ID that was parsed.
Definition at line 64 of file CacheTime.php.
|
protected |
TS_MW timestamp when this object was generated, or -1 for not cacheable.
Used in ParserCache.
Definition at line 53 of file CacheTime.php.
Referenced by MediaWiki\Parser\CacheTime\getCacheTime().
|
protected |
ParserOptions which have been taken into account to produce output, option names stored in array keys.
Definition at line 47 of file CacheTime.php.