[Zope] storing persisten object in python dictionaries
Juergen.Herrmann at XLhost.de
Thu Oct 26 08:44:51 EDT 2006
i have a writeen am framework where objects have unique ids and
instances are stored in btreefolders, one per class.
if i want to retrieve an instance based on id, i lookup it's class
name and the get the class' container path from my metadata manager
now i traverse to this container and get the object with given id
the process of traversing to the class' container folder is done
on each object get. a cool optimization for me would be to cache
class container folders in a python dictionary (much faster than
traversal), but this doesn't work. the main problem is that
objects retrieved from these cached folders have broken acquisition.
actually i asked a similar question some time ago and was told:
"don't store persistent objects in python dicts."
i changed my code back to traversal and everything works, but now
i finally reached the optimization stage and profiling indeed shows
a huge improvement in object lookup with class container caching
so can anybody tell me why this doesn't work, or what to respect
to make it working? btw. the cache dict is implemented as a volatile
attribute (_v_classContainerDict) of a singleton object in the db.
>> XLhost.de - eXperts in Linux hosting <<
Konrad Adenauer Allee 43, DE-93051 Regensburg
Fon: +49 (0)700 XLHOSTDE [0700 95467833]
Fax: +49 (0)721 151 463027
More information about the Zope