Ticket #11 (closed enhancement: fixed)
implement intelligent purging of cache
|Reported by:||lapo@…||Owned by:||moo|
|Blocked By:||PHP Version:|
|Application:||Need User Feedback:|
Description (last modified by moo) (diff)
Correct me if I'm wrong, but right now XCache doesn't seem to purge old scripts from the cache in any way, so if the memory is not enough to cache them all it works on a "first arrived, first served" basis, and once the cache is full no other scrippt will ever be cache, while maybe there are many script in cache that are only seldom used.
It would be nice to have an intelligent way to purge the cache of "unused" scripts.
Some examples that come to my mind:
- delete all the scripts that were not used in the last X seconds (just as EA does, not very powerful IMHO)
- sort the scripts by last use and delete the older 10%
- use more more complex sorting logic, such as "A*last_use + B*size" with A and B two customizable numeric constants
- call a PHP hook to let the "reaper logic" be implemented in a script itself: it could receive the cache data and free size needed and return the names or IDs of the scripts to be purged (alternatively it could be added a xcache_ function to purge a single script instead of the entire cache as xcache_clear_cache() does)