[Zope-DB] Controlling Z SQL caching
ianb at colorstudy.com
Wed Feb 25 17:42:12 EST 2004
Dieter Maurer wrote:
> Ian Bicking wrote at 2004-2-24 16:12 -0600:
>>I've decided that I definitely need some caching in a database-driven
>>application I'm working on, but I need to be able to invalidate the
>>cache on a query.
> Have a look at "CCZSQLMethods"
> It will not work for a ZEO setup.
Thanks for the pointer. And the code, of course :)
Our administrator is a little wary of SharedResource -- I think he's
worried it may not be portable across versions of Zope, or something of
that sort. From my (very brief) look, it seems like it's really very
Zope neutral (maybe too neutral, hence not working with ZEO), and
shouldn't be a problem when upgrading Zope. Any warnings or
reassurances you might be able to provide?
When you say it won't work with ZEO, I assume that means that cache
purges won't be propagated to different Zope instances, since
SharedResource (and hence caching) is not ZODB-aware (which would
otherwise be fine for a cache).
> I don't see any way to do that with Z SQL methods.
> You can flush the cache by writing the Z SQL Method ("_p_changed=1")
> and deleting its "_v_" attributes.
Hmm, like (?):
zSQLMethod._p_changed = 1
# Maybe some ZODB stuff I don't understand (I'm a ZODB-newbie),
# my vague guess:
Or do I have the _v_cache and _p_changed backwards? I guess I don't
really understand this.
(BTW, I had a problem with CCSQLMethods/SQL.py, line 51:
and it works fine)
More information about the Zope-DB