MediaWiki  1.23.15
CacheTime Class Reference

Parser cache specific expiry check. More...

Inheritance diagram for CacheTime:

Public Member Functions

 containsOldMagic ()
 
 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 ()
 
 isCacheable ()
 
 isDifferentRevision ( $id)
 Return true if this cached output object is for a different revision of the page. More...
 
 setCacheRevisionId ( $id)
 
 setCacheTime ( $t)
 setCacheTime() sets the timestamp expressing when the page has been rendered. More...
 
 setContainsOldMagic ( $com)
 
 updateCacheExpiry ( $seconds)
 Sets the number of seconds after which this object should expire. More...
 

Public Attributes

 $mCacheExpiry = null
 
 $mCacheRevisionId = null
 
 $mCacheTime = ''
 
 $mContainsOldMagic
 
array bool $mUsedOptions
 ParserOptions which have been taken into account to produce output or false if not available. More...
 
 $mVersion = Parser::VERSION
 

Detailed Description

Parser cache specific expiry check.

Definition at line 29 of file CacheTime.php.

Member Function Documentation

◆ containsOldMagic()

CacheTime::containsOldMagic ( )
Returns
bool

Definition at line 50 of file CacheTime.php.

References $mContainsOldMagic.

Referenced by getCacheExpiry().

◆ expired()

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.

Parameters
string$touchedthe affected article's last touched timestamp
Returns
Boolean

Definition at line 161 of file CacheTime.php.

References getCacheExpiry(), getCacheTime(), global, isCacheable(), TS_MW, and wfTimestamp().

◆ getCacheExpiry()

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.

Returns
int|mixed|null

Definition at line 120 of file CacheTime.php.

References $mCacheExpiry, containsOldMagic(), and global.

Referenced by expired(), and isCacheable().

◆ getCacheRevisionId()

CacheTime::getCacheRevisionId ( )
Since
1.23
Returns
int|null Revision id, if any was set

Definition at line 76 of file CacheTime.php.

References $mCacheRevisionId.

Referenced by isDifferentRevision().

◆ getCacheTime()

CacheTime::getCacheTime ( )
Returns
string TS_MW timestamp

Definition at line 43 of file CacheTime.php.

References TS_MW, and wfTimestamp().

Referenced by expired().

◆ isCacheable()

CacheTime::isCacheable ( )
Returns
bool

Definition at line 149 of file CacheTime.php.

References getCacheExpiry().

Referenced by expired().

◆ isDifferentRevision()

CacheTime::isDifferentRevision (   $id)

Return true if this cached output object is for a different revision of the page.

Todo:
We always return false if $this->getCacheRevisionId() is null; this prevents invalidating the whole parser cache when this change is deployed. Someday that should probably be changed.
Since
1.23
Parameters
int$idthe affected article's current revision id
Returns
Boolean

Definition at line 183 of file CacheTime.php.

References getCacheRevisionId().

◆ setCacheRevisionId()

CacheTime::setCacheRevisionId (   $id)
Since
1.23
Parameters
$idint Revision id

Definition at line 84 of file CacheTime.php.

◆ setCacheTime()

CacheTime::setCacheTime (   $t)

setCacheTime() sets the timestamp expressing when the page has been rendered.

This does not control expiry, see updateCacheExpiry() for that!

Parameters
$tstring
Returns
string

Definition at line 68 of file CacheTime.php.

References $t, and wfSetVar().

◆ setContainsOldMagic()

CacheTime::setContainsOldMagic (   $com)
Parameters
$combool
Returns
bool

Definition at line 58 of file CacheTime.php.

References wfSetVar().

◆ updateCacheExpiry()

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().

Parameters
$secondsnumber

Definition at line 98 of file CacheTime.php.

Referenced by ParserCache\save().

Member Data Documentation

◆ $mCacheExpiry

CacheTime::$mCacheExpiry = null

Definition at line 36 of file CacheTime.php.

Referenced by getCacheExpiry().

◆ $mCacheRevisionId

CacheTime::$mCacheRevisionId = null

Definition at line 38 of file CacheTime.php.

Referenced by getCacheRevisionId().

◆ $mCacheTime

CacheTime::$mCacheTime = ''

Definition at line 35 of file CacheTime.php.

◆ $mContainsOldMagic

CacheTime::$mContainsOldMagic

Definition at line 36 of file CacheTime.php.

Referenced by containsOldMagic().

◆ $mUsedOptions

array bool CacheTime::$mUsedOptions

ParserOptions which have been taken into account to produce output or false if not available.

Definition at line 32 of file CacheTime.php.

◆ $mVersion

CacheTime::$mVersion = Parser::VERSION

Definition at line 34 of file CacheTime.php.


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