This lets large output entries fit into memcached via key segmentation.
Follows
b09b3980f99 which applied the feature to PageEditStash.
Bug: T204742
Change-Id: I33a60f5d718cd9033ea12d1d16046d2bede87b5b
const USE_ANYTHING = 3;
/** @var BagOStuff */
const USE_ANYTHING = 3;
/** @var BagOStuff */
/**
* Anything cached prior to this is invalidated
/**
* Anything cached prior to this is invalidated
* @throws MWException
*/
public function __construct( BagOStuff $cache, $cacheEpoch = '20030516000000' ) {
* @throws MWException
*/
public function __construct( BagOStuff $cache, $cacheEpoch = '20030516000000' ) {
$this->cacheEpoch = $cacheEpoch;
}
$this->cacheEpoch = $cacheEpoch;
}
$pageid = $article->getId();
$renderkey = (int)( $wgRequest->getVal( 'action' ) == 'render' );
$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 mixed|string
*/
protected function getOptionsKey( $page ) {
* @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 ) {
* @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
}
// 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() ) ) {
$this->getOptionsKey( $article ), BagOStuff::READ_VERIFIED );
if ( $optionsKey instanceof CacheTime ) {
if ( $useOutdated < self::USE_EXPIRED && $optionsKey->expired( $article->getTouched() ) ) {
$casToken = null;
/** @var ParserOutput $value */
$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" );
if ( !$value ) {
wfDebug( "ParserOutput cache miss.\n" );
$this->incrementStats( $article, "miss.absent" );
}
$expire = $parserOutput->getCacheExpiry();
}
$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();
$cacheTime = $cacheTime ?: wfTimestampNow();
if ( !$revId ) {
$revision = $page->getRevision();
wfDebug( $msg );
// Save the parser output
wfDebug( $msg );
// Save the parser output
- $this->mMemc->set( $parserOutputKey, $parserOutput, $expire );
+ $this->cache->set(
+ $parserOutputKey,
+ $parserOutput,
+ $expire,
+ BagOStuff::WRITE_ALLOW_SEGMENTS
+ );
- $this->mMemc->set( $this->getOptionsKey( $page ), $optionsKey, $expire );
+ $this->cache->set( $this->getOptionsKey( $page ), $optionsKey, $expire );
Hooks::run(
'ParserCacheSaveComplete',
Hooks::run(
'ParserCacheSaveComplete',
* @return BagOStuff
*/
public function getCacheStorage() {
* @return BagOStuff
*/
public function getCacheStorage() {