From ff375dd5f78978fb8d5159c25782448b7e198233 Mon Sep 17 00:00:00 2001 From: Tim Starling Date: Thu, 16 Mar 2006 02:57:44 +0000 Subject: [PATCH] Save the last modified timestamp to the parser cache, to avoid the need for a revision row load on hits. --- includes/OutputPage.php | 2 +- includes/ParserCache.php | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/includes/OutputPage.php b/includes/OutputPage.php index 3517e45d4d..b90faf87cb 100644 --- a/includes/OutputPage.php +++ b/includes/OutputPage.php @@ -360,7 +360,7 @@ class OutputPage { * * @return bool */ - function tryParserCache( $article, $user ) { + function tryParserCache( &$article, $user ) { $parserCache =& ParserCache::singleton(); $parserOutput = $parserCache->get( $article, $user ); if ( $parserOutput !== false ) { diff --git a/includes/ParserCache.php b/includes/ParserCache.php index d9a7c849b6..712c664cdf 100644 --- a/includes/ParserCache.php +++ b/includes/ParserCache.php @@ -78,8 +78,10 @@ class ParserCache { } $this->mMemc->delete( $key ); $value = false; - } else { + if ( isset( $value->mTimestamp ) ) { + $article->mTimestamp = $value->mTimestamp; + } wfIncrStats( "pcache_hit" ); } } else { @@ -97,6 +99,10 @@ class ParserCache { $key = $this->getKey( $article, $user ); $now = wfTimestampNow(); $parserOutput->setCacheTime( $now ); + + // Save the timestamp so that we don't have to load the revision row on view + $parserOutput->mTimestamp = $article->getTimestamp(); + $parserOutput->mText .= "\n\n"; wfDebug( "Saved in parser cache with key $key and timestamp $now\n" ); -- 2.20.1