MDL-78109 core_cache: Remove harmful requirelockingwrite/read options

These cache options are not used in core and would cause a performance
cost without any benefit if ever used. Also they don't work properly.
This commit is contained in:
sam marshall 2023-05-03 10:47:08 +01:00
parent ef93325f27
commit 8df2ac4e98
5 changed files with 21 additions and 249 deletions

View file

@ -2095,32 +2095,6 @@ class cache_test extends \advanced_testcase {
$this->assertEquals(false, $cache2->get('var'));
}
/**
* Test application locking.
*/
public function test_application_locking() {
$instance = cache_config_testing::instance(true);
$instance->phpunit_add_definition('phpunit/test_application_locking', array(
'mode' => cache_store::MODE_APPLICATION,
'component' => 'phpunit',
'area' => 'test_application_locking',
'staticacceleration' => true,
'staticaccelerationsize' => 1,
'requirelockingread' => true,
'requirelockingwrite' => true
));
$cache = cache::make('phpunit', 'test_application_locking');
$this->assertInstanceOf(cache_application::class, $cache);
$this->assertTrue($cache->set('a', 'A'));
$this->assertTrue($cache->set('b', 'B'));
$this->assertTrue($cache->set('c', 'C'));
$this->assertEquals('A', $cache->get('a'));
$this->assertEquals(array('b' => 'B', 'c' => 'C'), $cache->get_many(array('b', 'c')));
$this->assertTrue($cache->delete('a'));
$this->assertFalse($cache->has('a'));
}
/**
* The application locking feature should work with caches that support multiple identifiers
* (static cache and MongoDB with a specific setting).
@ -2172,28 +2146,6 @@ class cache_test extends \advanced_testcase {
$this->assertFalse($cache->set('b', 'B'));
}
/**
* Test that invalid lock setting combinations are caught.
*
* @covers ::make
*/
public function test_application_conflicting_locks() {
$instance = cache_config_testing::instance(true);
$instance->phpunit_add_definition('phpunit/test_application_locking', array(
'mode' => cache_store::MODE_APPLICATION,
'component' => 'phpunit',
'area' => 'test_application_locking',
'staticacceleration' => true,
'staticaccelerationsize' => 1,
'requirelockingwrite' => true,
'requirelockingbeforewrite' => true,
));
$this->expectException('coding_exception');
cache::make('phpunit', 'test_application_locking');
}
/**
* Test that locking before write works when writing across multiple layers.
*