Also make use of getWithSetCallback() while at it.
Change-Id: I6bd29db7c6564fcaf4489ec0f226ac83bafc75e8
protected $rclistOpen;
protected $rcMoveIndex;
protected $rclistOpen;
protected $rcMoveIndex;
- /** @var MapCacheLRU */
- protected $watchingCache;
+ /** @var BagOStuff */
+ protected $watchMsgCache;
/**
* Changeslist constructor
/**
* Changeslist constructor
$this->skin = $obj;
}
$this->preCacheMessages();
$this->skin = $obj;
}
$this->preCacheMessages();
- $this->watchingCache = new MapCacheLRU( 50 );
+ $this->watchMsgCache = new HashBagOStuff( array( 'maxKeys' => 50 ) );
* @return string
*/
protected function numberofWatchingusers( $count ) {
* @return string
*/
protected function numberofWatchingusers( $count ) {
- $cache = $this->watchingCache;
- if ( $count > 0 ) {
- if ( !$cache->has( $count ) ) {
- $cache->set( $count, $this->msg( 'number_of_watching_users_RCview' )
- ->numParams( $count )->escaped() );
- }
-
- return $cache->get( $count );
- } else {
+ $cache = $this->watchMsgCache;
+ $that = $this;
+ return $cache->getWithSetCallback( $count, $cache::TTL_INDEFINITE,
+ function () use ( $that, $count ) {
+ return $that->msg( 'number_of_watching_users_RCview' )
+ ->numParams( $count )->escaped();
+ }
+ );