[Zope-DB] CCSQLMethods

Dieter Maurer dieter@handshake.de
Thu, 13 Feb 2003 21:44:21 +0100


Maciej Wi=1B-B=B6niowski wrote at 2003-2-13 15:59 +0100:=1B-A
 > I'm using Dieter Maurer's 'CCSQLMethods':
 > http://www.dieter.handshake.de/pyprojects/zope/CCSQLMethod.html It wor=
ks
 > really good, but I don't know how to use FlushCacheEntry Method.
 > ...
 > The definition is as follows:
 > flushCacheEntry(REQUEST=3DNone, **kw)
 >=20
 > and what is the role of REQUEST parameter? Do I need to pass all the q=
uery
 > parameters to this method?
"flushCacheEntry" mimicks the calling conventions of Z SQL Methods.

The reason is simple:

  A Z SQL Method's cache is a dictionary with
  tuples of argument values as keys.

  In order to flush a cache entry, you must specify the tuple
  of argument values.

  The easiest way is to use whatever the Z SQL Method does
  to determine the argument tuple and than flush the
  corresponding entry.

  This is what "flushCacheEntry" does.

That said:

  A Z SQL Method (and "flushCacheEntry") can get its arguments either
  (exclusive):

    *  keyword parameters (that's what the "**kw" is for)

    *  a dictionary (positional) argument (that's the "REQIEST=3DNone")

    *  the implicitly acquired REQUEST object (then, you pass no
       parameters).

  When you call your Z SQL Method "meth" with

       meth(...here-is-something-or-nothing...)

  then

       fluchCacheEntry(...here-is-something-or-nothing...)

  flushed the entry (potentially) created by the "meth" call.
  =20


Dieter