From 6986130f33ec9b08316ad9e506c18f4ab817e04a Mon Sep 17 00:00:00 2001 From: Aaron Schulz Date: Wed, 11 Jul 2018 14:04:36 +0100 Subject: [PATCH] Convert ChangesList to using MapCacheLRU Change-Id: I1cafb601dc644ca6d58ec0430e9608cfb497bcd8 --- includes/changes/ChangesList.php | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/includes/changes/ChangesList.php b/includes/changes/ChangesList.php index c0822c3438..eb9febea08 100644 --- a/includes/changes/ChangesList.php +++ b/includes/changes/ChangesList.php @@ -44,7 +44,7 @@ class ChangesList extends ContextSource { /** @var callable */ protected $changeLinePrefixer; - /** @var BagOStuff */ + /** @var MapCacheLRU */ protected $watchMsgCache; /** @@ -72,7 +72,7 @@ class ChangesList extends ContextSource { $this->skin = $obj; } $this->preCacheMessages(); - $this->watchMsgCache = new HashBagOStuff( [ 'maxKeys' => 50 ] ); + $this->watchMsgCache = new MapCacheLRU( 50 ); $this->linkRenderer = MediaWikiServices::getInstance()->getLinkRenderer(); $this->filterGroups = $filterGroups; } @@ -602,10 +602,9 @@ class ChangesList extends ContextSource { if ( $count <= 0 ) { return ''; } - $cache = $this->watchMsgCache; - return $cache->getWithSetCallback( - $cache->makeKey( 'watching-users-msg', $count ), - $cache::TTL_INDEFINITE, + + return $this->watchMsgCache->getWithSetCallback( + "watching-users-msg:$count", function () use ( $count ) { return $this->msg( 'number_of_watching_users_RCview' ) ->numParams( $count )->escaped(); -- 2.20.1