From: Aaron Schulz Date: Sun, 24 May 2015 07:59:49 +0000 (-0700) Subject: Process cache tagUsageStatistics() to improve performance X-Git-Tag: 1.31.0-rc.0~11279^2 X-Git-Url: http://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/pie.php?a=commitdiff_plain;h=c9ceccc196bec331b72da19a84c2a7675b799c68;p=lhc%2Fweb%2Fwiklou.git Process cache tagUsageStatistics() to improve performance Change-Id: I4a95c00d84c216ad08f30f0971877dfb728f86ff --- diff --git a/includes/changetags/ChangeTags.php b/includes/changetags/ChangeTags.php index a730116679..79763bd2d3 100644 --- a/includes/changetags/ChangeTags.php +++ b/includes/changetags/ChangeTags.php @@ -1177,9 +1177,15 @@ class ChangeTags { * @return array Array of string => int */ public static function tagUsageStatistics() { - $fname = __METHOD__; + static $cachedStats = null; - return ObjectCache::getMainWANInstance()->getWithSetCallback( + // Process cache to avoid I/O and repeated regens during holdoff + if ( $cachedStats !== null ) { + return $cachedStats; + } + + $fname = __METHOD__; + $cachedStats = ObjectCache::getMainWANInstance()->getWithSetCallback( wfMemcKey( 'change-tag-statistics' ), function() use ( $fname ) { $out = array(); @@ -1209,6 +1215,8 @@ class ChangeTags { array( wfMemcKey( 'change-tag-statistics' ) ), array( 'lockTSE' => INF ) ); + + return $cachedStats; } /**