Skip to content
Permalink
Browse files

Apply patch from 'biesbjerg' to ApcEngine

This set of changes allows ApcEngine to work with APCu and newer
versions of APC.

Fixes #3749
  • Loading branch information...
markstory committed Jun 20, 2014
1 parent 6a8033a commit e6836163298c49bd8430f6f2a93200099afed6ea
Showing with 13 additions and 6 deletions.
  1. +13 −6 lib/Cake/Cache/Engine/ApcEngine.php
@@ -125,12 +125,19 @@ public function clear($check) {
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')) {

This comment has been minimized.

@jippi

jippi Jun 22, 2014

Member

if (class_exists('APCIterator', false)) no reason to invoke the auto loading for it :)

This comment has been minimized.

@markstory

markstory Jun 22, 2014

Author Member

Good point, I can change that today.

$iterator = new APCIterator(
'user',
'/^' . preg_quote($this->settings['prefix'], '/') . '/',
APC_ITER_NONE
);
apc_delete($iterator);

This comment has been minimized.

@dereuromark

dereuromark Jun 20, 2014

Member

if you returned true (return early) you could omit the else case.

This comment has been minimized.

@markstory

markstory Jun 20, 2014

Author Member

Good point, I'll fix that up.

} 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;

0 comments on commit e683616

Please sign in to comment.
You can’t perform that action at this time.