From: Tim Starling Date: Tue, 4 Jan 2005 12:54:07 +0000 (+0000) Subject: stats merged from REL1_3A X-Git-Tag: 1.5.0alpha1~998 X-Git-Url: http://git.cyclocoop.org/%24image?a=commitdiff_plain;h=9daededf7f625af249cf81d05a430e3727003775;p=lhc%2Fweb%2Fwiklou.git stats merged from REL1_3A --- diff --git a/includes/ParserCache.php b/includes/ParserCache.php index 00ed003058..4447869b31 100644 --- a/includes/ParserCache.php +++ b/includes/ParserCache.php @@ -35,6 +35,7 @@ class ParserCache { $hash = $user->getPageRenderingHash(); $pageid = intval( $article->getID() ); $key = $this->getKey( $article, $user ); + wfDebug( "Trying parser cache $key\n" ); $value = $this->mMemc->get( $key ); if ( is_object( $value ) ) { @@ -45,15 +46,21 @@ class ParserCache { $touched = $article->mTouched; if ( !$canCache || $value->expired( $touched ) ) { if ( !$canCache ) { + $this->incrStats( "pcache_miss_invalid" ); wfDebug( "Invalid cached redirect, touched $touched, epoch $wgCacheEpoch, cached $cacheTime\n" ); } else { + $this->incrStats( "pcache_miss_expired" ); wfDebug( "Key expired, touched $touched, epoch $wgCacheEpoch, cached $cacheTime\n" ); } $this->mMemc->delete( $key ); $value = false; + + } else { + $this->incrStats( "pcache_hit" ); } } else { wfDebug( "Parser cache miss.\n" ); + $this->incrStats( "pcache_miss_absent" ); $value = false; } @@ -75,6 +82,14 @@ class ParserCache { } $this->mMemc->set( $key, $parserOutput, $expire ); } + + function incrStats( $key ) { + global $wgDBname, $wgMemc; + $key = "$wgDBname:stats:$key"; + if ( is_null( $wgMemc->incr( $key ) ) ) { + $wgMemc->add( $key, 1 ); + } + } }