[Zope] API for Zope cacheing
Dieter Maurer
dieter@handshake.de
Wed, 18 Dec 2002 23:41:45 +0100
Felix Ulrich-Oltean writes:
> Is there an API for using Zope's cacheing machinery from python
> products?
Look at the methods provided by a RAMCacheManager.
I would use my "DocFinder" (<http://www.dieter.handshake.de/pyprojects/zope>)
> Specifically, I have a subclass of SimpleUserFolder which calls 20+ SQL
> statements every time it's called just to work out the user's details -
> this is all very cacheable and I can see that Zope provides various
> caches - there are some useful-looking methods in RAMCacheManager.py,
> but I was wondering if there is a 'known' way to do it.
You may also consider caching the Z SQL Methods (controlled via
their "Advanced" tab).
Do not forget to invalidate the cache, when you add/change users.
This can be done by editing the Z SQL Method or by using
my "CacheControlled ZSQL Methods" (see above, for the URL).
Dieter