ZODB Caching and XML Document
Hi, I'm implementing a site which as a mix of html and Docbook XML documents. I looked at the XML Document Product and liked the philosophy. The way I understand it, a DOM tree is created at document checkin time and stored in the object database. When a request comes in for some method on the tree, it is retrieved from the database and displayed, etc. ZODB has a cache. On such a DOM tree request, what exactly is cached. Is it the entire DOM tree object. If so how can I control the individual caching of the object(can I do that). Having to pull a large DOM tree out of the ZODB will hurt in time I would think(any benchmarks?) and having that tree available in memory would be great. Also, are results of methods on the DOM tree cached. So If the client requests to display node6 and all under it, will the results os the method implementing the request be cached? In general, can a particulay python data structure be marked with some cache properties. I would like to use 4DOM/4XSLT later so I can provide PDF hardcopy for the online documents on a section/by section basis (a "print basket" if you may) Thanks, Rahul
At 12:23 PM 10/13/99 -0400, Rahul Dave wrote:
Hi, I'm implementing a site which as a mix of html and Docbook XML documents. I looked at the XML Document Product and liked the philosophy. The way I understand it, a DOM tree is created at document checkin time and stored in the object database. When a request comes in for some method on the tree, it is retrieved from the database and displayed, etc.
ZODB has a cache. On such a DOM tree request, what exactly is cached.
Nodes of an XML Document are persistent Zope objects. ZODB takes care of moving them in and out of memory just as it does for all persistent objects. This caching is controlled by the Database settings in the Control Panel. In general, Zope moves objects out of memory if they haven't been accessed for a certain amount of time. See the ZODB UML model for the gory details: http://www.zope.org/Documentation/Developer/Models/ZODB
Is it the entire DOM tree object. If so how can I control the individual caching of the object(can I do that).
You cannot control caching very directly at the ZODB level, but in general you shouldn't have to.
Having to pull a large DOM tree out of the ZODB will hurt in time I would think(any benchmarks?) and having that tree available in memory would be great.
Also, are results of methods on the DOM tree cached. So If the client requests to display node6 and all under it, will the results os the method implementing the request be cached?
The results of method calls are not cached in Zope. Some caching is done under the covers in DTML methods, but this is just name lookup caching. If you wish you can write methods (probably as external methods) that do caching, if you find performance to be a problem. This would require knowing Python. Here's an example of a simple-minded approach: def callExpensiveMethod(self, param): """ Call some expensive method, caching the results for a fixed period of time. """ if time.time() - self.last_called < self.cache_time: return self.cached_results self.cached_results=self.expensiveMethod(param) self.last_called=time.time() return self.cached_results There are many, many other caching systems that might be more appropriate to your particular case.
In general, can a particulay python data structure be marked with some cache properties.
No. There has been talk at various times about various caching systems that Zope could implement. Check the zope-dev archives. If you're interesting in discussing this more, I suggest that you take it to zope-dev.
I would like to use 4DOM/4XSLT later so I can provide PDF hardcopy for the online documents on a section/by section basis (a "print basket" if you may)
Sounds interesting! -Amos
participants (2)
-
Amos Latteier -
Rahul Dave