[Zope-dev] Cache code in Shared/DC/ZRDB/DA.py
tino at wildenhain.de
Fri Nov 17 02:14:57 EST 2006
Chris Withers schrieb:
> Hi Jim,
> I'm wondering if you can still remember the rational behind the cache
> code at around lines 355-387 of:
> This code is pretty old (checked in 5th Dec 1997) but has started
> causing a few people problems under high load:
> In particular:
> - in line 368, why is len(cache)>max_cache/2 used as a trigger to start
> cache clearing? (the /2 in particular)
> - does it matter that IOBTree.Bucket has gone away and that tcache is
> now a simple dictionary? It certainly seems to make the keys.reverse()
> on line 370 superfluous and the keys[-1]<t on line 371 less reliable.
> More generally, do you or does anyone else have any attachment to this
> code or would anyone mind if I ripped it out and replaced it with
> something simpler, with more comments and unit tests?
I have a replacement started, which uses Cacheable mixin instead.
Advantage is, with RAM Cache Manager you can see the hits your method
cause and invalide the cache per object. I also introduced a execution
time treshold, so you can configure to only cache runtimes say above
1 sec, leaving more room for long running queries.
I think I should packe up what I have now (rough edges) so you
can have a look at it.
More information about the Zope-Dev