[Zope-dev] ZCatalog caching with memcached

Christian Theune ct at gocept.com
Sat Oct 25 09:04:57 EDT 2008


On Sat, 2008-10-25 at 14:53 +0200, Hedley Roos wrote:
> > I'd love if this wouldn't be a monkey patch.
> 
> So would I, but I couldn't find another way in this case.
> 
> >
> > Also, there is nothing that makes this integrate correctly with
> > transactions. Your cache will happily deliver never-committed data and
> > also it will not isolate transactions from each other.
> >
> I patched 4 methods - clear, search, catalogObject, uncatalogObject.
> 
> Method clear is the simplest one - I simply flush the cache.

This is probably harmless but will cause unnecessary cache flushes for
other clients.

> Methods catalogObject and uncatalogObject both invalidate the cache.
> Should the transaction fail later the only drawback is that you threw
> a few things out of the cache. They'll soon be re-entered by
> subsequent searches.

Right. This is the same as clear.

> Method search just inspects queries and stores results to memcache.

That's the issue.

If you catalog an object, then search for it and then abort the
transaction, your cache will have data in it that isn't committed.

Additionally when another transaction is already running in parallel, it
will see cache inserts from other transactions.

Christian

-- 
Christian Theune · ct at gocept.com
gocept gmbh & co. kg · forsterstraße 29 · 06112 halle (saale) · germany
http://gocept.com · tel +49 345 1229889 7 · fax +49 345 1229889 1
Zope and Plone consulting and development
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: This is a digitally signed message part
Url : http://mail.zope.org/pipermail/zope-dev/attachments/20081025/cf0526b3/attachment-0001.bin 


More information about the Zope-Dev mailing list