Krinkle has uploaded a new change for review.
https://gerrit.wikimedia.org/r/257206
Change subject: Use wfGetParserCache() instead of $wgMemc in showCacheStats.php
......................................................................
Use wfGetParserCache() instead of $wgMemc in showCacheStats.php
This script interacts with keys set by ParserCache.php, which
uses singleton set by $wgParserCacheType, not $wgMainCacheType.
Change-Id: Id6a62aec57801085ed684af9362a96eca0914e92
---
M maintenance/showCacheStats.php
1 file changed, 12 insertions(+), 12 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core
refs/changes/06/257206/1
diff --git a/maintenance/showCacheStats.php b/maintenance/showCacheStats.php
index 3d16af1..6f5a181 100644
--- a/maintenance/showCacheStats.php
+++ b/maintenance/showCacheStats.php
@@ -40,18 +40,18 @@
}
public function execute() {
- global $wgMemc;
+ $cache = wfGetParserCacheStorage();
// Can't do stats if
- if ( get_class( $wgMemc ) == 'EmptyBagOStuff' ) {
+ if ( get_class( $cache ) == 'EmptyBagOStuff' ) {
$this->error( "You are running EmptyBagOStuff, I can
not provide any statistics.", true );
}
$this->output( "\nParser cache\n" );
- $hits = intval( $wgMemc->get( wfMemcKey( 'stats', 'pcache_hit'
) ) );
- $expired = intval( $wgMemc->get( wfMemcKey( 'stats',
'pcache_miss_expired' ) ) );
- $absent = intval( $wgMemc->get( wfMemcKey( 'stats',
'pcache_miss_absent' ) ) );
- $stub = intval( $wgMemc->get( wfMemcKey( 'stats',
'pcache_miss_stub' ) ) );
+ $hits = intval( $cache->get( wfMemcKey( 'stats', 'pcache_hit' )
) );
+ $expired = intval( $cache->get( wfMemcKey( 'stats',
'pcache_miss_expired' ) ) );
+ $absent = intval( $cache->get( wfMemcKey( 'stats',
'pcache_miss_absent' ) ) );
+ $stub = intval( $cache->get( wfMemcKey( 'stats',
'pcache_miss_stub' ) ) );
$total = $hits + $expired + $absent + $stub;
if ( $total ) {
$this->output( sprintf( "hits: %-10d
%6.2f%%\n", $hits, $hits / $total * 100 ) );
@@ -72,9 +72,9 @@
}
$this->output( "\nImage cache\n" );
- $hits = intval( $wgMemc->get( wfMemcKey( 'stats',
'image_cache_hit' ) ) );
- $misses = intval( $wgMemc->get( wfMemcKey( 'stats',
'image_cache_miss' ) ) );
- $updates = intval( $wgMemc->get( wfMemcKey( 'stats',
'image_cache_update' ) ) );
+ $hits = intval( $cache->get( wfMemcKey( 'stats',
'image_cache_hit' ) ) );
+ $misses = intval( $cache->get( wfMemcKey( 'stats',
'image_cache_miss' ) ) );
+ $updates = intval( $cache->get( wfMemcKey( 'stats',
'image_cache_update' ) ) );
$total = $hits + $misses;
if ( $total ) {
$this->output( sprintf( "hits: %-10d
%6.2f%%\n", $hits, $hits / $total * 100 ) );
@@ -89,9 +89,9 @@
}
$this->output( "\nDiff cache\n" );
- $hits = intval( $wgMemc->get( wfMemcKey( 'stats',
'diff_cache_hit' ) ) );
- $misses = intval( $wgMemc->get( wfMemcKey( 'stats',
'diff_cache_miss' ) ) );
- $uncacheable = intval( $wgMemc->get( wfMemcKey( 'stats',
'diff_uncacheable' ) ) );
+ $hits = intval( $cache->get( wfMemcKey( 'stats',
'diff_cache_hit' ) ) );
+ $misses = intval( $cache->get( wfMemcKey( 'stats',
'diff_cache_miss' ) ) );
+ $uncacheable = intval( $cache->get( wfMemcKey( 'stats',
'diff_uncacheable' ) ) );
$total = $hits + $misses + $uncacheable;
if ( $total ) {
$this->output( sprintf( "hits: %-10d
%6.2f%%\n", $hits, $hits / $total * 100 ) );
--
To view, visit https://gerrit.wikimedia.org/r/257206
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Id6a62aec57801085ed684af9362a96eca0914e92
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Krinkle <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits