test: Improved MemcachedEngineTest/MemcacheEngineTest.

This commit is contained in:
Koji Tanaka 2023-01-07 21:18:43 +09:00 committed by Kamil Wylegala
parent d7d7230929
commit bab8a84436
2 changed files with 8 additions and 0 deletions

View file

@ -378,6 +378,10 @@ class MemcacheEngineTest extends CakeTestCase {
$this->assertEquals('cache1', Cache::read('some_value', 'memcache')); $this->assertEquals('cache1', Cache::read('some_value', 'memcache'));
Cache::write('some_value', 'cache2', 'memcache2'); Cache::write('some_value', 'cache2', 'memcache2');
// Wait until the written key can be retrieved with Memcache::getExtendedStats(), as there may be a delay.
sleep(1);
$result = Cache::clear(false, 'memcache'); $result = Cache::clear(false, 'memcache');
$this->assertTrue($result); $this->assertTrue($result);
$this->assertFalse(Cache::read('some_value', 'memcache')); $this->assertFalse(Cache::read('some_value', 'memcache'));

View file

@ -686,6 +686,10 @@ class MemcachedEngineTest extends CakeTestCase {
$this->assertEquals('cache1', Cache::read('some_value', 'memcached')); $this->assertEquals('cache1', Cache::read('some_value', 'memcached'));
Cache::write('some_value', 'cache2', 'memcached2'); Cache::write('some_value', 'cache2', 'memcached2');
// Wait until the written key can be retrieved with Memcached::getAllKeys(), as there may be a delay.
sleep(1);
$result = Cache::clear(false, 'memcached'); $result = Cache::clear(false, 'memcached');
$this->assertTrue($result); $this->assertTrue($result);
$this->assertFalse(Cache::read('some_value', 'memcached')); $this->assertFalse(Cache::read('some_value', 'memcached'));