r105492 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r105491‎ | r105492 | r105493 >
Date:23:52, 7 December 2011
Author:awjrichards
Status:ok
Tags:
Comment:
Making long cache time configurable
Modified paths:
  • /trunk/extensions/ContributionReporting/ContributionReporting.php (modified) (history)
  • /trunk/extensions/ContributionReporting/FundraiserStatistics_body.php (modified) (history)

Diff [purge]

Index: trunk/extensions/ContributionReporting/ContributionReporting.php
@@ -115,9 +115,12 @@
116116 $egFundraiserStatisticsMinimum = 1;
117117 $egFundraiserStatisticsMaximum = 10000;
118118
119 -// Cache timeout for fundraiser statistics, in seconds
 119+// Cache timeout for fundraiser statistics (short timeout), in seconds
120120 $egFundraiserStatisticsCacheTimeout = 900; // 15 minutes
 121+// Cache timeout for fundraiser statistics (long timeout), in seconds
 122+$wgFundraiserStatisticsLongCacheTimeout = 60 * 60 * 24 * 7; // one week
121123
 124+
122125 $wgContributionTrackingStatisticsViewWeeks = 3;
123126
124127 $commonModuleInfo = array(
Index: trunk/extensions/ContributionReporting/FundraiserStatistics_body.php
@@ -312,7 +312,7 @@
313313 * @return an array of results or null
314314 */
315315 private function query( $mostRecent, $start, $end ) {
316 - global $wgMemc, $egFundraiserStatisticsMinimum, $egFundraiserStatisticsMaximum, $egFundraiserStatisticsCacheTimeout;
 316+ global $wgMemc, $egFundraiserStatisticsMinimum, $egFundraiserStatisticsMaximum, $egFundraiserStatisticsCacheTimeout, $wgFundraiserStatisticsLongCacheTimeout;
317317
318318 // Conctruct the key for memcached
319319 $key = wfMemcKey( 'fundraiserstatistics', $start, $end );
@@ -359,11 +359,11 @@
360360 if ( isset( $result ) ) {
361361 // Store the result in memcached.
362362 // If it's the most recent fundraiser, cache for a short period of time, otherwise
363 - // cache for 24 hours (since the query is expensive).
 363+ // cache for long period of time
364364 if ( $mostRecent ) {
365365 $wgMemc->set( $key, $result, $egFundraiserStatisticsCacheTimeout );
366366 } else {
367 - $wgMemc->set( $key, $result, 86400 );
 367+ $wgMemc->set( $key, $result, $wgFundraiserStatisticsLongCacheTimeout );
368368 }
369369 return $result;
370370 }

Follow-up revisions

RevisionCommit summaryAuthorDate
r105494MFT r105492awjrichards23:54, 7 December 2011

Status & tagging log