[Zope-dev] ZCatalog caching with memcached

Hedley Roos hedleyroos at gmail.com
Sat Oct 25 09:09:32 EDT 2008


On Sat, Oct 25, 2008 at 2:57 PM, Andreas Jung <lists at zopyx.com> wrote:
> On 25.10.2008 14:53 Uhr, 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.
>>
>> 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.
>
> Using a DataManager is likely the better and more safe choice.
>
> Andreas
>

Thanks Andreas. I'll have a look at your code when available.

Christian, I do have a mistake in my reasoning. If an object is added
to the catalog in a transaction and I cache that object as result of a
query in that same transaction, and then the transaction fails I'll
have a bad cache.

H


More information about the Zope-Dev mailing list