How to store in a RAM cache a list of objects?
I'd like to RAM cache the result of a long-runing ZopeFind method, formatted to a plain list of objects. But the RAM cache doesn't store the list and hence every time the supossedly cached method is called, the ZopeFind process id triggered. Other data (like the lenght of the resulting list) is stored and retrieved with no problem, telling by the cache manager's stats tab. Is that normal behaviour of the RAM cache machinery? I'm using Zope 2.73 on a w2k box, and the objects are sort of instances of the ExtFile(ExtImage) product. (Although the same happens with plain DTML Documents that I created for test purposes.) In both cases I set the "threshold entries" to a number higher than the lenght of the list, and also did the same with the "cache-size" in zope.conf Thanks in advance, Ausum
Ausum Studio wrote at 2005-9-26 03:19 -0500:
I'd like to RAM cache the result of a long-runing ZopeFind method, formatted to a plain list of objects. But the RAM cache doesn't store the list and hence every time the supossedly cached method is called, the ZopeFind process id triggered. Other data (like the lenght of the resulting list) is stored and retrieved with no problem, telling by the cache manager's stats tab.
Is that normal behaviour of the RAM cache machinery?
It is very dangerous (and almost impossible) to cache persistent objects outside of their ZODB connection. The RAM Cache Manager knows about this danger and tries to make sure, it caches only simple objects (not sure that it catches persistent objects). For this reason, you cannot cache the full result of a "ZopeFind". However, you can cache the paths part of it. -- Dieter
participants (2)
-
Ausum Studio -
Dieter Maurer