const USE_ANYTHING = 3;
/** @var BagOStuff */
- private $mMemc;
+ private $cache;
/**
* Anything cached prior to this is invalidated
* @throws MWException
*/
public function __construct( BagOStuff $cache, $cacheEpoch = '20030516000000' ) {
- $this->mMemc = $cache;
+ $this->cache = $cache;
$this->cacheEpoch = $cacheEpoch;
}
$pageid = $article->getId();
$renderkey = (int)( $wgRequest->getVal( 'action' ) == 'render' );
- $key = $this->mMemc->makeKey( 'pcache', 'idhash', "{$pageid}-{$renderkey}!{$hash}" );
+ $key = $this->cache->makeKey( 'pcache', 'idhash', "{$pageid}-{$renderkey}!{$hash}" );
return $key;
}
* @return mixed|string
*/
protected function getOptionsKey( $page ) {
- return $this->mMemc->makeKey( 'pcache', 'idoptions', $page->getId() );
+ return $this->cache->makeKey( 'pcache', 'idoptions', $page->getId() );
}
/**
* @since 1.28
*/
public function deleteOptionsKey( $page ) {
- $this->mMemc->delete( $this->getOptionsKey( $page ) );
+ $this->cache->delete( $this->getOptionsKey( $page ) );
}
/**
}
// Determine the options which affect this article
- $optionsKey = $this->mMemc->get(
+ $optionsKey = $this->cache->get(
$this->getOptionsKey( $article ), BagOStuff::READ_VERIFIED );
if ( $optionsKey instanceof CacheTime ) {
if ( $useOutdated < self::USE_EXPIRED && $optionsKey->expired( $article->getTouched() ) ) {
$casToken = null;
/** @var ParserOutput $value */
- $value = $this->mMemc->get( $parserOutputKey, BagOStuff::READ_VERIFIED );
+ $value = $this->cache->get( $parserOutputKey, BagOStuff::READ_VERIFIED );
if ( !$value ) {
wfDebug( "ParserOutput cache miss.\n" );
$this->incrementStats( $article, "miss.absent" );
}
$expire = $parserOutput->getCacheExpiry();
- if ( $expire > 0 && !$this->mMemc instanceof EmptyBagOStuff ) {
+ if ( $expire > 0 && !$this->cache instanceof EmptyBagOStuff ) {
$cacheTime = $cacheTime ?: wfTimestampNow();
if ( !$revId ) {
$revision = $page->getRevision();
wfDebug( $msg );
// Save the parser output
- $this->mMemc->set( $parserOutputKey, $parserOutput, $expire );
+ $this->cache->set(
+ $parserOutputKey,
+ $parserOutput,
+ $expire,
+ BagOStuff::WRITE_ALLOW_SEGMENTS
+ );
// ...and its pointer
- $this->mMemc->set( $this->getOptionsKey( $page ), $optionsKey, $expire );
+ $this->cache->set( $this->getOptionsKey( $page ), $optionsKey, $expire );
Hooks::run(
'ParserCacheSaveComplete',
* @return BagOStuff
*/
public function getCacheStorage() {
- return $this->mMemc;
+ return $this->cache;
}
}