Migrate EchoLocalCache to MapCacheLRU

Change-Id: Ie007bc5ec1db4d9686ced724b87f9cbc328aa339
This commit is contained in:
Aaron Schulz 2018-08-15 12:30:45 -07:00
parent bacee60d42
commit 4939bff723
2 changed files with 7 additions and 5 deletions

View file

@ -15,7 +15,7 @@ abstract class EchoLocalCache {
/** /**
* Target object cache * Target object cache
* @var HashBagOStuff * @var MapCacheLRU
*/ */
protected $targets; protected $targets;
@ -34,7 +34,7 @@ abstract class EchoLocalCache {
* Use Factory method like EchoTitleLocalCache::create() * Use Factory method like EchoTitleLocalCache::create()
*/ */
protected function __construct() { protected function __construct() {
$this->targets = new HashBagOStuff( [ 'maxKeys' => self::TARGET_MAX_NUM ] ); $this->targets = new MapCacheLRU( self::TARGET_MAX_NUM );
} }
/** /**
@ -91,7 +91,9 @@ abstract class EchoLocalCache {
} }
/** /**
* @return BagOStuff * Get the process cache for testing
*
* @return MapCacheLRU
*/ */
public function getTargets() { public function getTargets() {
return $this->targets; return $this->targets;

View file

@ -82,8 +82,8 @@ class EchoTitleLocalCacheTest extends MediaWikiTestCase {
$cache->clearAll(); $cache->clearAll();
$this->assertEmpty( $cache->getLookups() ); $this->assertEmpty( $cache->getLookups() );
$this->assertEquals( false, $cache->getTargets()->get( 1 ) ); $this->assertEquals( null, $cache->getTargets()->get( 1 ) );
$this->assertEquals( false, $cache->getTargets()->get( '1' ) ); $this->assertEquals( null, $cache->getTargets()->get( '1' ) );
} }
/** /**