[Zope] Caching custom ZClasses

Dieter Maurer dieter at handshake.de
Wed Aug 27 22:36:31 EDT 2003


Bart Hubbard wrote at 2003-8-26 15:13 -0500:
 > I've created a set of custom ZClasses, and can't associate them with a cache
 > manager.  I see there isn't a baseclass available in the ZMI that corresponds to
 > the 'Cacheable' class in 'cache.py' in the OFS directory of Zope.  I suppose I
 > could subclass another class that is cacheable, like DTML Document, but will
 > that just cache the DTML Document portions of my class?
 > 
 > I just want my ZClass to be cacheable, so ideas are welcome.

Cachable classes must implement the ZCachable protocol.

This essentially means that they themselves must ask the cache manager,
whether it already has something cached for them and if not,
register the computed value with the cache manager.

This is built in into many basic object classes.
But, as you easily understand, it is impossible for ZClasses.

You may build wrappers around your ZClass methods (!) implementing
the ZCachable protocol.


Dieter



More information about the Zope mailing list