|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #60720 delete only expired/updated from cache
Submitted: 2012-01-11 19:26 UTC Modified: 2016-11-18 20:55 UTC
Avg. Score:4.8 ± 0.4
Reproduced:1 of 1 (100.0%)
Same Version:2 (200.0%)
Same OS:2 (200.0%)
From: ck+php dot net at bbshowcase dot org Assigned:
Status: Wont fix Package: APC (PECL)
PHP Version: Irrelevant OS:
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please — but make sure to vote on the bug!
Your email address:
Solve the problem:
39 - 21 = ?
Subscribe to this entry?

 [2012-01-11 19:26 UTC] ck+php dot net at bbshowcase dot org
I would love to see an alternate function in the API and button in the APC control panel that clears only expired scripts (those with newer timestamps on disk than in the cache) instead of only using the "clear all" feature.

Essentially this is a "stat once" ability.

This feature exists in eaccelerator and is very useful for those that run with the STAT feature turned off, on active servers with a great deal of scripts.

This way only the one or two scripts that were replaced are cleared out and the rest are left in place for best performance.

I've enclosed code that does this via PHP and the API but the problem is without direct support from native code, open_basedir (and/or safemode) will cause this to fail in many environments because it cannot examine the scripts on disk outside the control panel path and will throw an access error.

This is a similar request that was denied in 2007 under bug #57783 "selectively clear cache" - I am hoping it's a good time to re-examine this need as servers are larger and support more active connections than ever before.

I am specifically asking for native support so files can be examined outside of open_basedir restrictions.

Test script:
$data = apc_cache_info(); 
if (empty($data['cache_list'])) { die('no cached files?');}
foreach ($data['cache_list'] as $file) {
	if (!empty($file['mtime']) && !empty($file['filename']) 
		&& (!file_exists($file['filename']) || (int)$file['mtime']<filemtime($file['filename']))) {
if (!empty($expired)) {apc_delete_file($expired);} 
echo count($expired),' removed from cache';


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2012-01-22 19:52 UTC]
-Status: Open +Status: Assigned -Assigned To: +Assigned To: gopalv
 [2016-11-18 20:55 UTC]
-Status: Assigned +Status: Wont fix -Assigned To: gopalv +Assigned To:
 [2016-11-18 20:55 UTC]
APC is no longer supported in favor of opcache that comes bundled with PHP, if you wish to use the user cache, then look at PECL/APCu.
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon May 20 05:01:32 2024 UTC