From bab8a844364e7e9f7103e4a9027dda8bfe033871 Mon Sep 17 00:00:00 2001 From: Koji Tanaka Date: Sat, 7 Jan 2023 21:18:43 +0900 Subject: [PATCH] test: Improved MemcachedEngineTest/MemcacheEngineTest. --- lib/Cake/Test/Case/Cache/Engine/MemcacheEngineTest.php | 4 ++++ lib/Cake/Test/Case/Cache/Engine/MemcachedEngineTest.php | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/lib/Cake/Test/Case/Cache/Engine/MemcacheEngineTest.php b/lib/Cake/Test/Case/Cache/Engine/MemcacheEngineTest.php index 938df0916..05a6dbf24 100644 --- a/lib/Cake/Test/Case/Cache/Engine/MemcacheEngineTest.php +++ b/lib/Cake/Test/Case/Cache/Engine/MemcacheEngineTest.php @@ -378,6 +378,10 @@ class MemcacheEngineTest extends CakeTestCase { $this->assertEquals('cache1', Cache::read('some_value', 'memcache')); 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'); $this->assertTrue($result); $this->assertFalse(Cache::read('some_value', 'memcache')); diff --git a/lib/Cake/Test/Case/Cache/Engine/MemcachedEngineTest.php b/lib/Cake/Test/Case/Cache/Engine/MemcachedEngineTest.php index 8b73f6385..2d9107139 100644 --- a/lib/Cake/Test/Case/Cache/Engine/MemcachedEngineTest.php +++ b/lib/Cake/Test/Case/Cache/Engine/MemcachedEngineTest.php @@ -686,6 +686,10 @@ class MemcachedEngineTest extends CakeTestCase { $this->assertEquals('cache1', Cache::read('some_value', 'memcached')); 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'); $this->assertTrue($result); $this->assertFalse(Cache::read('some_value', 'memcached'));