mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Echo
synced 2024-11-24 07:54:13 +00:00
Migrate EchoLocalCache to MapCacheLRU
Change-Id: Ie007bc5ec1db4d9686ced724b87f9cbc328aa339
This commit is contained in:
parent
bacee60d42
commit
4939bff723
8
includes/cache/LocalCache.php
vendored
8
includes/cache/LocalCache.php
vendored
|
@ -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;
|
||||
|
|
4
tests/phpunit/cache/TitleLocalCacheTest.php
vendored
4
tests/phpunit/cache/TitleLocalCacheTest.php
vendored
|
@ -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' ) );
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue