From 4939bff72309d90e9b3fd519a48274073f59ffe0 Mon Sep 17 00:00:00 2001 From: Aaron Schulz Date: Wed, 15 Aug 2018 12:30:45 -0700 Subject: [PATCH] Migrate EchoLocalCache to MapCacheLRU Change-Id: Ie007bc5ec1db4d9686ced724b87f9cbc328aa339 --- includes/cache/LocalCache.php | 8 +++++--- tests/phpunit/cache/TitleLocalCacheTest.php | 4 ++-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/includes/cache/LocalCache.php b/includes/cache/LocalCache.php index a726dcbf8..d9624c3a3 100644 --- a/includes/cache/LocalCache.php +++ b/includes/cache/LocalCache.php @@ -15,7 +15,7 @@ abstract class EchoLocalCache { /** * Target object cache - * @var HashBagOStuff + * @var MapCacheLRU */ protected $targets; @@ -34,7 +34,7 @@ abstract class EchoLocalCache { * Use Factory method like EchoTitleLocalCache::create() */ 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() { return $this->targets; diff --git a/tests/phpunit/cache/TitleLocalCacheTest.php b/tests/phpunit/cache/TitleLocalCacheTest.php index 4b18eda0e..c637f0165 100644 --- a/tests/phpunit/cache/TitleLocalCacheTest.php +++ b/tests/phpunit/cache/TitleLocalCacheTest.php @@ -82,8 +82,8 @@ class EchoTitleLocalCacheTest extends MediaWikiTestCase { $cache->clearAll(); $this->assertEmpty( $cache->getLookups() ); - $this->assertEquals( false, $cache->getTargets()->get( 1 ) ); - $this->assertEquals( false, $cache->getTargets()->get( '1' ) ); + $this->assertEquals( null, $cache->getTargets()->get( 1 ) ); + $this->assertEquals( null, $cache->getTargets()->get( '1' ) ); } /**