diff --git a/lib/Cake/Cache/Engine/MemcachedEngine.php b/lib/Cake/Cache/Engine/MemcachedEngine.php index a2611396a..331b8a352 100644 --- a/lib/Cake/Cache/Engine/MemcachedEngine.php +++ b/lib/Cake/Cache/Engine/MemcachedEngine.php @@ -273,7 +273,8 @@ class MemcachedEngine extends CacheEngine { * * @param bool $check If true no deletes will occur and instead CakePHP will rely * on key TTL values. - * @return bool True if the cache was successfully cleared, false otherwise + * @return bool True if the cache was successfully cleared, false otherwise. Will + * also return false if you are using a binary protocol. */ public function clear($check) { if ($check) { @@ -281,6 +282,9 @@ class MemcachedEngine extends CacheEngine { } $keys = $this->_Memcached->getAllKeys(); + if ($keys === false) { + return false; + } foreach ($keys as $key) { if (strpos($key, $this->settings['prefix']) === 0) {