[Zope] temporary exclude page from ram-cache
Sascha Welter
zopelist at betabug.ch
Thu Dec 6 04:13:29 EST 2007
(Wed, Dec 05, 2007 at 04:33:33PM +0100) Jaroslav Lukesh
wrote/schrieb/egrapse:
> I have RAM-cached page that looks for data from SQLdb. For error
> suppression (yea, I use MSSQL which make sometime unbelievable SQL
> error with the same errorless query) I use try-except wrapper, but in
> some cases page is cached without db results for a looooong time.
>
> I know how to invalidate already rendered page from a ram cache, but
> I does not know how to temporal disable RAM-cache during rendering of
> that page.
If with the ramcached "page" you mean a ZPT, the answer is "don't do
this". Please refer to the RAM Cache documentation why not to cache
complete ZPTs.
The proper setup is to cache only the method that returns the data, if
you do that you can look at the result and/or check if any exceptions
were raised and decide if you update the cache or not.
When you look at the example code on http://betabug.ch/blogs/ch-athens/635
you see immediately where you can decide to do self.ZCacheable_set or
not.
Regards,
Sascha
More information about the Zope
mailing list