Merge "tests: Remove unused $wgMemc resets"
[lhc/web/wiklou.git] / includes / parser / ParserCache.php
index abff543..0eba166 100644 (file)
@@ -139,7 +139,9 @@ class ParserCache {
                }
 
                // Determine the options which affect this article
-               $optionsKey = $this->mMemc->get( $this->getOptionsKey( $article ) );
+               $casToken = null;
+               $optionsKey = $this->mMemc->get(
+                       $this->getOptionsKey( $article ), $casToken, BagOStuff::READ_VERIFIED );
                if ( $optionsKey instanceof CacheTime ) {
                        if ( !$useOutdated && $optionsKey->expired( $article->getTouched() ) ) {
                                wfIncrStats( "pcache.miss.expired" );
@@ -198,7 +200,8 @@ class ParserCache {
                        return false;
                }
 
-               $value = $this->mMemc->get( $parserOutputKey );
+               $casToken = null;
+               $value = $this->mMemc->get( $parserOutputKey, $casToken, BagOStuff::READ_VERIFIED );
                if ( !$value ) {
                        wfDebug( "ParserOutput cache miss.\n" );
                        wfIncrStats( "pcache.miss.absent" );
@@ -226,11 +229,17 @@ class ParserCache {
                        wfIncrStats( "pcache.miss.revid" );
                        $revId = $article->getLatest();
                        $cachedRevId = $value->getCacheRevisionId();
-                       wfDebug( "ParserOutput key is for an old revision, latest $revId, cached $cachedRevId\n" );
+                       wfDebug(
+                               "ParserOutput key is for an old revision, latest $revId, cached $cachedRevId\n"
+                       );
                        $value = false;
-               } elseif ( Hooks::run( 'RejectParserCacheValue', array( $value, $wikiPage, $popts ) ) === false ) {
+               } elseif (
+                       Hooks::run( 'RejectParserCacheValue', array( $value, $wikiPage, $popts ) ) === false
+               ) {
                        wfIncrStats( 'pcache.miss.rejected' );
-                       wfDebug( "ParserOutput key valid, but rejected by RejectParserCacheValue hook handler.\n" );
+                       wfDebug(
+                               "ParserOutput key valid, but rejected by RejectParserCacheValue hook handler.\n"
+                       );
                        $value = false;
                } else {
                        wfIncrStats( "pcache.hit" );
@@ -284,7 +293,10 @@ class ParserCache {
                        // ...and its pointer
                        $this->mMemc->set( $this->getOptionsKey( $page ), $optionsKey, $expire );
 
-                       Hooks::run( 'ParserCacheSaveComplete', array( $this, $parserOutput, $page->getTitle(), $popts, $revId ) );
+                       Hooks::run(
+                               'ParserCacheSaveComplete',
+                               array( $this, $parserOutput, $page->getTitle(), $popts, $revId )
+                       );
                } else {
                        wfDebug( "Parser output was marked as uncacheable and has not been saved.\n" );
                }