[Zope-DB] Flushing _v_ attributes (was: Re: Cache Controlled SQL methods (CCSQLMethod))

Dieter Maurer dieter@handshake.de
Mon, 20 Jan 2003 20:53:59 +0100


Dieter Maurer wrote at 2003-1-19 01:21 +0100:
 > Z SQL Methods maintain their cache in volatile attributes ("_v_" attributes).
 > These attributes are flushed (in all caches belonging
 > to this version) when the object is written.
 > 
 > There is a possibility to flush the attributes without writing
 > the object. It's a bit tricky, though:
 > 
 >   conn= object._p_jar  # the connection, the object belongs to
 >   db= conn.db()        # the associated database
 >   db.begin_invalidation()
 >   db.invalidate(object._p_oid) # invalidates the object in all caches
 >   db.finish_invalidation()
 > 
 > When you invalidate an object in this way, the object must not be
 > modified in the current transaction. Otherwise, a "ConflictError"
 > will result.
 > 
 > 
 > Of course, this method gives you not such fine grained
 > control you get with Cache Controlled Z SQL Methods.
I should add, that neither CacheControlled Z SQL Methods
nor the technique outlined above will work in a ZEO setup.

I fear that in this case you need to write to the Z SQL Method
to invalidate the cache across ZEO clients.


Dieter