r60982 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r60981‎ | r60982 | r60983 >
Date:19:48, 12 January 2010
Author:tparscal
Status:ok
Tags:
Comment:
Made use of the $exp parameter of $wgMemc->set() rather than using unique keys for every minute, thus reducing number of items in the cache pool. This has the side effect of invalidating 1 minute from a page view rather than being locked to real time as it was before, which is probably not noticable to the user.
Modified paths:
  • /trunk/extensions/ContributionReporting/FundraiserStatistics_body.php (modified) (history)

Diff [purge]

Index: trunk/extensions/ContributionReporting/FundraiserStatistics_body.php
@@ -213,8 +213,7 @@
214214 private function query( $type, $start, $end ) {
215215 global $wgMemc, $egFundraiserStatisticsMinimum, $egFundraiserStatisticsMaximum;
216216
217 - // Try cache - key exipires once per minute
218 - $key = wfMemcKey( 'fundraiserstatistics', $type, $start, $end, date( 'YmdHi' ) );
 217+ $key = wfMemcKey( 'fundraiserstatistics', $type, $start, $end );
219218 $cache = $wgMemc->get( $key );
220219 if ( $cache != false && $cache != -1 ) {
221220 return $cache;
@@ -304,7 +303,8 @@
305304 break;
306305 }
307306 if ( isset( $result ) ) {
308 - $wgMemc->set( $key, $result );
 307+ // Cache invalidates once per minute
 308+ $wgMemc->set( $key, $result, 60 );
309309 return $result;
310310 }
311311 return null;

Status & tagging log