Merge pull request #7552 from cakephp/issue-7546

Fix error when Memcached::getAllKeys() fails.
This commit is contained in:
José Lorenzo Rodríguez 2015-10-17 15:46:33 +02:00
commit d0e7a2fd38

View file

@ -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) {