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'));