[Zope-dev] RAM Cache Manager "next_cleanup" not working?

Shane Hathaway shane@digicool.com
Wed, 18 Jul 2001 14:57:34 -0400


"Júlio Dinis Silva" wrote:
> Looking into lib.python.Products.standardCacheManagers.RAMCacheManager.py
> 
> I found something it looks like a problem in the code and
> I came to a solution which solves the problem in subject althougt
> I dont know If this is a safe solution, It works for me.

The theory behind the current solution is that a cache cleanup operation
occurs:

- only if a certain amount of time has passed since the last cleanup,
and

- only when adding a new entry to the cache.

Then, even during a cleanup, nothing is removed if the number of entries
is below the threshold.

The idea is that cache hits should be as fast as possible.  Cleanup
occurs on cache misses instead.  The only side effect is that watching
for entries to get cleaned up on the stats page won't act as you might
expect.  The number of entries will *always* go above the threshold. 
The entries will be cleaned up next time there's a cache *miss*.

This is *not* a bug.  But maybe we could "fix" it by executing a cleanup
every time users look at the stats page. :-)

Another idea is for you to create your own cache manager.  In fact we
(Digital Creations) encourage the creation of alternate cache managers.

Shane