http://www.mediawiki.org/wiki/Special:Code/MediaWiki/60982

Revision: 60982
Author:   tparscal
Date:     2010-01-12 19:48:19 +0000 (Tue, 12 Jan 2010)

Log Message:
-----------
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: trunk/extensions/ContributionReporting/FundraiserStatistics_body.php
===================================================================
--- trunk/extensions/ContributionReporting/FundraiserStatistics_body.php        
2010-01-12 19:47:59 UTC (rev 60981)
+++ trunk/extensions/ContributionReporting/FundraiserStatistics_body.php        
2010-01-12 19:48:19 UTC (rev 60982)
@@ -213,8 +213,7 @@
        private function query( $type, $start, $end ) {
                global $wgMemc, $egFundraiserStatisticsMinimum, 
$egFundraiserStatisticsMaximum;
                
-               // Try cache - key exipires once per minute
-               $key = wfMemcKey( 'fundraiserstatistics', $type, $start, $end, 
date( 'YmdHi' ) );
+               $key = wfMemcKey( 'fundraiserstatistics', $type, $start, $end );
                $cache = $wgMemc->get( $key );
                if ( $cache != false && $cache != -1 ) {
                        return $cache;
@@ -304,7 +303,8 @@
                                break;
                }
                if ( isset( $result ) ) {
-                       $wgMemc->set( $key, $result );
+                       // Cache invalidates once per minute
+                       $wgMemc->set( $key, $result, 60 );
                        return $result;
                }
                return null;



_______________________________________________
MediaWiki-CVS mailing list
MediaWiki-CVS@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to