php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #57783 selectively clear cache
Submitted: 2007-08-13 18:10 UTC Modified: 2007-08-18 16:41 UTC
From: sukibabee at gmail dot com Assigned:
Status: Closed Package: APC (PECL)
PHP Version: Irrelevant OS: Irrelevant
Private report: No CVE-ID: None
 [2007-08-13 18:10 UTC] sukibabee at gmail dot com
Description:
------------
When apc.stat=0, the only way to refresh cache entries is to restart Apache or clear the entire cache with apc_clear_cache().  I would like a mechanism to clear specific entries of the cache.

apc_compile_file() does not work as expected also.


Reproduce code:
---------------
n/a

Expected result:
----------------
I expected apc_compile_file() to enable me to achieve a similar result - by forcing an entry to be refreshed.  But apc_compile_file() does nothing to an existing cache entry if apc.stat=0.

While that feature would be nice - this is not the ideal solution.  A new API call to remove an entry in the cache would be better.  But if this is too difficult to implement - forcing a refresh with apc_compile_file() would work too, and should be an easy change.

Actual result:
--------------
The reason to include such a feature is to leverage APC for data-storage.  Example : you want a simple mapping of UserId to Username, and you have a lot of users.  You want a lookup to be fast - so rather than incorporating a database, or reading a large serialized structure ... store the data as PHP code and use APC to cache it.  Since the data does not change often, you also want to turn off apc.stat to improve performance even more.

When the data is changed though, you need to clear the cache entry.  While forcing a refresh works, if you change the cache multiple times between accessing it - you are unnecessarily updating it more than you need to.


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-08-18 16:40 UTC] gopalv82 at yahoo dot com
shire@ put in a fix

http://news.php.net/php.pecl.cvs/8441

But do read http://pooteeweet.org/blog/721 before you rely on disk files for cached storage.

And if you use apc_compile() for things other than merely initially priming a server, stuff might blow up & I can't fix it.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 25 11:01:30 2024 UTC