[Zope] Invalidating object(s) in the Zope RAM Cache
Peter Sabaini
peter at sabaini.at
Thu Dec 11 03:57:41 EST 2003
Elfyn McBratney wrote:
> Dieter Maurer wrote:
>
>
>>Elfyn McBratney wrote at 2003-12-10 16:50 -0000:
>>
>>
>>>...
>>>So, the question is: Is there a way that I can invalidate an object
>>>from the Zope RAM cache using the Zope API?
>>
>>Sure: you can do it from the ZMI (Ram Cache Manager --> "Statistics" -->
>>cache entry --> "Invalidate").
>>Thus, you can do it via the API (as the ZMI does precisely that). Look how
>>the ZMI does it.
>
>
> Sorry, my post was lacking in detail.
>
> I have been doing it via the ZMI but it's a bit tedious to have to do that
> everytime an article is posted. =) I'll hunt for the source... *should
> have done that in the first place* :-)
>
self.ZCacheable_invalidate()
clears the whole cache provided self is an object subclassed from
Cache.Cacheable
If you want to clear a single cache entry its a little more complicated.
I do it with:
c = self.ZCacheable_getCache()
if c is not None:
keywords = { ... my cache keys ...}
try:
oc = c.getObjectCacheEntries(self)
index = oc.aggregateIndex(view_name, None,
c.request_vars, keywords)
oc.delEntry(index)
except AttributeError: ... do something ....
- peter.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 3461 bytes
Desc: S/MIME Cryptographic Signature
Url : http://mail.zope.org/pipermail/zope/attachments/20031211/d64254ad/smime.bin
More information about the Zope
mailing list