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

Shane Hathaway shane@digicool.com
Thu, 19 Jul 2001 12:30:57 -0400 (EDT)


On Thu, 19 Jul 2001, J=FAlio Dinis Silva wrote:

> -create a dtml method with only this line of code: <dtml-var ZopeTime>
> -create a Ram cache manager, define 0 (zero) for the threshold and
> 5 seconds for the cleanup interval, and associate your dtml method
> with this Ram Cache manager.
> -Then go to a browser and request several times the dtml method
> and you will see that the zopetime returned by the dtml method
> never changes, even after 5 seconds.
>
> Isnt this suppose to work? I mean, there is a threshold of 0 (zero)
> so when the 5 seconds pass the call to cleanup should cleanup
> this entry because there will be 1 entry and the threshold is 0 (zero).

No, it's not supposed to work. :-)  Create another DTML method and
associate it with the same cache manager, then view the new DTML method.
This will cause ZCache_set() to be called and *then* the cache will be
cleaned up.

What you really want to use is the max_age parameter.  (It might only be
in Zope 2.4.x.)  You want the cache of the DTML method to expire after a
certain time period, right?  Use max_age.  When the cache retrieves an
expired cache entry, the entry will be removed and later replaced.

Each parameter serves a very distinct purpose.  The max_age parameter is
meant for cache duration control.  The threshold parameter is meant for
balancing memory use with cache size.  And the cleanup interval is to
balance memory management with cache performance overhead.  Does that make
sense?

Shane