From e6836163298c49bd8430f6f2a93200099afed6ea Mon Sep 17 00:00:00 2001 From: mark_story Date: Fri, 20 Jun 2014 13:55:26 -0400 Subject: [PATCH] Apply patch from 'biesbjerg' to ApcEngine This set of changes allows ApcEngine to work with APCu and newer versions of APC. Fixes #3749 --- lib/Cake/Cache/Engine/ApcEngine.php | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/lib/Cake/Cache/Engine/ApcEngine.php b/lib/Cake/Cache/Engine/ApcEngine.php index a06fbd3f7..7fa644b24 100644 --- a/lib/Cake/Cache/Engine/ApcEngine.php +++ b/lib/Cake/Cache/Engine/ApcEngine.php @@ -125,12 +125,19 @@ class ApcEngine extends CacheEngine { if ($check) { return true; } - $info = apc_cache_info('user'); - $cacheKeys = $info['cache_list']; - unset($info); - foreach ($cacheKeys as $key) { - if (strpos($key['info'], $this->settings['prefix']) === 0) { - apc_delete($key['info']); + if (class_exists('APCIterator')) { + $iterator = new APCIterator( + 'user', + '/^' . preg_quote($this->settings['prefix'], '/') . '/', + APC_ITER_NONE + ); + apc_delete($iterator); + } else { + $cache = apc_cache_info('user'); + foreach ($cache['cache_list'] as $key) { + if (strpos($key['info'], $this->settings['prefix']) === 0) { + apc_delete($key['info']); + } } } return true;