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.