Aaron Schulz has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/155471

Change subject: Bound the cache size of numberofWatchingusers()
......................................................................

Bound the cache size of numberofWatchingusers()

Change-Id: I60c9898318e340ee3c97d24b528d85a5f8c492e5
---
M includes/changes/ChangesList.php
1 file changed, 8 insertions(+), 5 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/71/155471/1

diff --git a/includes/changes/ChangesList.php b/includes/changes/ChangesList.php
index 9b9c102..3489926 100644
--- a/includes/changes/ChangesList.php
+++ b/includes/changes/ChangesList.php
@@ -460,14 +460,17 @@
         * @return string
         */
        protected function numberofWatchingusers( $count ) {
-               static $cache = array();
+               static $cache = null;
+               if ( $cache == null ) {
+                       $cache = new MapCacheLRU( 50 );
+               }
                if ( $count > 0 ) {
-                       if ( !isset( $cache[$count] ) ) {
-                               $cache[$count] = $this->msg( 
'number_of_watching_users_RCview' )
-                                       ->numParams( $count )->escaped();
+                       if ( !$cache->has( $count ) ) {
+                               $cache->set( $count, $this->msg( 
'number_of_watching_users_RCview' )
+                                       ->numParams( $count )->escaped() );
                        }
 
-                       return $cache[$count];
+                       return $cache->get( $count );
                } else {
                        return '';
                }

-- 
To view, visit https://gerrit.wikimedia.org/r/155471
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I60c9898318e340ee3c97d24b528d85a5f8c492e5
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Aaron Schulz <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to