return true;
}
+
+function wfIncrStats( $key ) {
+ global $wgDBname, $wgMemc;
+ $key = "$wgDBname:stats:$key";
+ if ( is_null( $wgMemc->incr( $key ) ) ) {
+ $wgMemc->add( $key, 1 );
+ }
+}
+
?>
$this->imagePath = $this->getFullPath();
}
}
+ if ( $this->dataLoaded ) {
+ wfIncrStats( 'image_cache_hit' );
+ } else {
+ wfIncrStats( 'image_cache_miss' );
+ }
wfProfileOut( $fname );
return $this->dataLoaded;
$touched = $article->mTouched;
if ( !$canCache || $value->expired( $touched ) ) {
if ( !$canCache ) {
- $this->incrStats( "pcache_miss_invalid" );
+ wfIncrStats( "pcache_miss_invalid" );
wfDebug( "Invalid cached redirect, touched $touched, epoch $wgCacheEpoch, cached $cacheTime\n" );
} else {
- $this->incrStats( "pcache_miss_expired" );
+ wfIncrStats( "pcache_miss_expired" );
wfDebug( "Key expired, touched $touched, epoch $wgCacheEpoch, cached $cacheTime\n" );
}
$this->mMemc->delete( $key );
$value = false;
} else {
- $this->incrStats( "pcache_hit" );
+ wfIncrStats( "pcache_hit" );
}
} else {
wfDebug( "Parser cache miss.\n" );
- $this->incrStats( "pcache_miss_absent" );
+ wfIncrStats( "pcache_miss_absent" );
$value = false;
}
}
$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 );
- }
- }
}
+++ /dev/null
-<?php
-/**
- * @package MediaWiki
- * @subpackage Maintenance
- */
-
-/** */
-require_once('commandLine.inc');
-
-foreach ( $wgLocalDatabases as $db ) {
- noisyDelete("$db:stats:pcache_hit");
- noisyDelete("$db:stats:pcache_miss_invalid");
- noisyDelete("$db:stats:pcache_miss_expired");
- noisyDelete("$db:stats:pcache_miss_absent");
-}
-
-/** @todo document */
-function noisyDelete( $key ) {
- global $wgMemc;
- /*
- print "$key ";
- if ( $wgMemc->delete($key) ) {
- print "deleted\n";
- } else {
- print "FAILED\n";
- }*/
- $wgMemc->delete($key);
-}
-?>
\ No newline at end of file
--- /dev/null
+<?php
+require_once('commandLine.inc');
+
+foreach ( $wgLocalDatabases as $db ) {
+ noisyDelete("$db:stats:pcache_hit");
+ noisyDelete("$db:stats:pcache_miss_invalid");
+ noisyDelete("$db:stats:pcache_miss_expired");
+ noisyDelete("$db:stats:pcache_miss_absent");
+ noisyDelete("$db:stats:image_cache_hit");
+ noisyDelete("$db:stats:image_cache_miss");
+ noisyDelete("$db:stats:image_cache_update");
+}
+
+function noisyDelete( $key ) {
+ global $wgMemc;
+ /*
+ print "$key ";
+ if ( $wgMemc->delete($key) ) {
+ print "deleted\n";
+ } else {
+ print "FAILED\n";
+ }*/
+ $wgMemc->delete($key);
+}
+?>
+++ /dev/null
-<?php
-/**
- * @package MediaWiki
- * @subpackage Maintenance
- */
-
-/** */
-require_once('commandLine.inc');
-
-$hits = intval($wgMemc->get("$wgDBname:stats:pcache_hit"));
-$invalid = intval($wgMemc->get("$wgDBname:stats:pcache_miss_invalid"));
-$expired = intval($wgMemc->get("$wgDBname:stats:pcache_miss_expired"));
-$absent = intval($wgMemc->get("$wgDBname:stats:pcache_miss_absent"));
-$total = $hits + $invalid + $expired + $absent;
-printf( "hits: %-10d %6.2f%%\n", $hits, $hits/$total*100 );
-printf( "invalid: %-10d %6.2f%%\n", $invalid, $invalid/$total*100 );
-printf( "expired: %-10d %6.2f%%\n", $expired, $expired/$total*100 );
-printf( "absent: %-10d %6.2f%%\n", $absent, $absent/$total*100 );
-printf( "total: %-10d %6.2f%%\n", $total, 100 );
-?>
\ No newline at end of file
--- /dev/null
+<?php
+require_once('commandLine.inc');
+
+$hits = intval($wgMemc->get("$wgDBname:stats:pcache_hit"));
+$invalid = intval($wgMemc->get("$wgDBname:stats:pcache_miss_invalid"));
+$expired = intval($wgMemc->get("$wgDBname:stats:pcache_miss_expired"));
+$absent = intval($wgMemc->get("$wgDBname:stats:pcache_miss_absent"));
+$total = $hits + $invalid + $expired + $absent;
+printf( "hits: %-10d %6.2f%%\n", $hits, $hits/$total*100 );
+printf( "invalid: %-10d %6.2f%%\n", $invalid, $invalid/$total*100 );
+printf( "expired: %-10d %6.2f%%\n", $expired, $expired/$total*100 );
+printf( "absent: %-10d %6.2f%%\n", $absent, $absent/$total*100 );
+printf( "total: %-10d %6.2f%%\n", $total, 100 );
+
+$hits = intval($wgMemc->get("$wgDBname:stats:image_cache_hit"));
+$misses = intval($wgMemc->get("$wgDBname:stats:image_cache_miss"));
+$updates = intval($wgMemc->get("$wgDBname:stats:image_cache_update"));
+$total = $hits + $misses;
+print("\nImage cache\n");
+printf( "hits: %-10d %6.2f%%\n", $hits, $hits/$total*100 );
+printf( "misses: %-10d %6.2f%%\n", $misses, $misses/$total*100 );
+printf( "updates: %-10d\n", $updates );
+
+?>