Index: trunk/phase3/includes/SiteStats.php |
— | — | @@ -114,9 +114,16 @@ |
115 | 115 | */ |
116 | 116 | static function numberingroup($group) { |
117 | 117 | if ( !isset( self::$groupMemberCounts[$group] ) ) { |
118 | | - $dbr = wfGetDB( DB_SLAVE ); |
119 | | - self::$groupMemberCounts[$group] = $dbr->selectField( 'user_groups', 'COUNT(*)', |
| 118 | + global $wgMemc; |
| 119 | + $key = wfMemcKey( 'SiteStats', 'groupcounts', $group ); |
| 120 | + $hit = $wgMemc->get( $key ); |
| 121 | + if ( !$hit ) { |
| 122 | + $dbr = wfGetDB( DB_SLAVE ); |
| 123 | + $hit = $dbr->selectField( 'user_groups', 'COUNT(*)', |
120 | 124 | array( 'ug_group' => $group ), __METHOD__ ); |
| 125 | + $wgMemc->set( $key, $hit, 3600 ); |
| 126 | + } |
| 127 | + self::$groupMemberCounts[$group] = $hit; |
121 | 128 | } |
122 | 129 | return self::$groupMemberCounts[$group]; |
123 | 130 | } |