class ParserOutput
{
var $mText, $mLanguageLinks, $mCategoryLinks, $mContainsOldMagic;
- var $mTouched; # Used for caching
+ var $mCacheTime; # Used in ParserCache
function ParserOutput( $text = "", $languageLinks = array(), $categoryLinks = array(),
$containsOldMagic = false )
$this->mLanguageLinks = $languageLinks;
$this->mCategoryLinks = $categoryLinks;
$this->mContainsOldMagic = $containsOldMagic;
- $this->mTouched = "";
+ $this->mCacheTime = "";
}
function getText() { return $this->mText; }
function getLanguageLinks() { return $this->mLanguageLinks; }
function getCategoryLinks() { return $this->mCategoryLinks; }
- function getTouched() { return $this->mTouched; }
+ function getCacheTime() { return $this->mCacheTime; }
function containsOldMagic() { return $this->mContainsOldMagic; }
function setText( $text ) { return wfSetVar( $this->mText, $text ); }
function setLanguageLinks( $ll ) { return wfSetVar( $this->mLanguageLinks, $ll ); }
function setCategoryLinks( $cl ) { return wfSetVar( $this->mCategoryLinks, $cl ); }
function setContainsOldMagic( $com ) { return wfSetVar( $this->mContainsOldMagic, $com ); }
- function setTouched( $t ) { return wfSetVar( $this->mTouched, $t ); }
+ function setCacheTime( $t ) { return wfSetVar( $this->mCacheTime, $t ); }
function merge( $other ) {
$this->mLanguageLinks = array_merge( $this->mLanguageLinks, $other->mLanguageLinks );
if ( $value ) {
# Delete if article has changed since the cache was made
$touched = $article->getTouched();
- if ( $value->getTouched() != $touched || $touched > $wgCacheEpoch ) {
+ if ( $value->getCacheTime() <= $touched || $value->getCacheTime < $wgCacheEpoch ) {
$wgMemc->delete( $key );
$value = false;
}
function save( $parserOutput, &$article, &$user ){
global $wgMemc;
$key = $this->getKey( $article, $user );
- $touched = $article->getTouched();
- $parserOutput->setTouched( $touched );
- $parserOutput->mText .= "\n<!-- Saved in parser cache with key $key and timestamp $touched -->\n";
+ $now = wfTimestampNow();
+ $parserOutput->setCacheTime( $now );
+ $parserOutput->mText .= "\n<!-- Saved in parser cache with key $key and timestamp $now -->\n";
if( $parserOutput->containsOldMagic() ){
$expire = 3600; # 1 hour
} else {
- $expire = 7*86400; # 7 days
+ $expire = 86400; # 1 day
}
$wgMemc->set( $key, $parserOutput, $expire );
}
-
}