Skip to content

Commit

Permalink
Apply patch from 'biesbjerg' to ApcEngine
Browse files Browse the repository at this point in the history
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 e683616
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions lib/Cake/Cache/Engine/ApcEngine.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Copy link
@jippi

jippi Jun 22, 2014

Contributor

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

This comment has been minimized.

Copy link
@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.

Copy link
@dereuromark

dereuromark Jun 20, 2014

Member

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

This comment has been minimized.

Copy link
@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;
Expand Down

0 comments on commit e683616

Please sign in to comment.