[Zope] Re: using the Cacheable API (was:
__before_publishing_traverse__ and caching)
Tobias Herp
therp at apriori.de
Thu Oct 23 06:28:58 EDT 2003
Jamie Heilman wrote:
> Tobias Herp wrote:
>
>>Isn't it sufficient to inherit Cacheable, and the result of the
>>index_html method will be cached? What more is needed?
>
>
> No its not sufficient, you have to actually use the ZCacheable
> API if you want to benefit from a cache manager. Read the source for
> another product like PythonScripts or PageTemplates to see examples of
> how to do it, but more importantly read OFS/Cache.py to see how it
> actually works.
Ok, after some reading in ZopePageTemplate.py my understanding is as
follows:
- when my object changes, ZCacheable_invalidate must be called
- in my index_html, try to get a cached value via ZCacheable_get
- if there is no cacheable value yet, store it via ZCacheable_set
- the keyset to use is a dictionary containing the request variables
which are the keys, e.g. { 'language': REQUEST.get('language'),
'template': REQUEST.get('template'), }
Correct? Still missing something?
Thanks,
Tobias
More information about the Zope
mailing list