Miles Waller wrote at 2006-12-21 17:31 +:
...
Now, if I access say, the title attribute of the top folder, the entire
folder object is loaded into memory. Am I correct that the subfolder
objects (attributes of the folder) are not loaded in at this point, just
references to them?
This should indeed happen: only the top folder is loaded with
persistent references to its persistent children.
The persistent reference is automatically turned into the true object
when one of the object's instance attributes it accessed
(description slightly simplified). At this point the object is loaded
from the storage.
Does the same apply to the DateTime objects which
are attributes of this folder?
No, as DateTime is not persistent, a DateTime instance is loaded as
soon as the object containing it is loaded.
At this point, how many objects would the cache show as needed to be loaded?
The cache will should the number of truely loaded persistent objects.
It will not count the persistent references nor any non persistent objects.
Assuming that I access the datetime attribute when I load the folder,
could I avoid evicting objects from the cache by storing dates as
strings rather than DateTimes, so I load one large object rather than two?
No. As DateTime is not persistent, DateTime instances are not
seen by the ZODB cache management (they behave like strings in this respect).
Also, am I right that the cache size is determined by total number of
objects, rather than by cache size?
Yes.
So loading a large file in, for
example, would not evict tons of objects to make room for it.
Hopefully, this is wrong.
The standard File implementations fragment their content over
a number of persistent objects. This is necessary in order not
to blow up your RAM requirements. Thus, a File instance is
indeed a collection of persistent objects -- and a huge File object
can evict larger numbers of other objects.
Of course, they might be unintelligent File implementations
(not the standard ones, but potentially third party developments).
--
Dieter
___
For more information about ZODB, see the ZODB Wiki:
http://www.zope.org/Wikis/ZODB/
ZODB-Dev mailing list - ZODB-Dev@zope.org
http://mail.zope.org/mailman/listinfo/zodb-dev