OFS.Cache.Cacheable.ZCacheable_invalidate and view_name
Hi Question is, what is view_name supposed to do during invalidation? In OFS.Cache.Cacheable we have: def ZCacheable_invalidate(self, view_name='', REQUEST=None): '''Called after a cacheable object is edited. Causes all cache entries that apply to the view_name to be removed. Returns a status message. ''' c = self.ZCacheable_getCache() if c is not None: ob, view_name = self.ZCacheable_getObAndView(view_name) try: message = c.ZCache_invalidate(ob) (...) and: def ZCacheable_getObAndView(self, view_name): (...) ob = self if not view_name and self.ZCacheable_isAMethod(): # This is a ZClass method. ob = aq_parent(aq_inner(self)) if isCacheable(ob): view_name = self.getId() else: # Both the parent and the child have to be # cacheable. ob = self return ob, view_name As far as I understand this, 'view_name' is useless here, and invalidation always occurs for all cache keys associated with object 'ob'. But this is not what docstring for ZCacheable_invalidate says. Seems strange but maybe I've missed something here? -- Maciej Wisniowski
No, you are right. The way the cache is constructed doesn't allow to purge by view_name. Stefan On 19. Nov 2006, at 13:46, Maciej Wisniowski wrote:
As far as I understand this, 'view_name' is useless here, and invalidation always occurs for all cache keys associated with object 'ob'. But this is not what docstring for ZCacheable_invalidate says. Seems strange but maybe I've missed something here?
-- Anything that happens, happens. --Douglas Adams
No, you are right. The way the cache is constructed doesn't allow to purge by view_name. So, is this a bug in Zope caching framework or a feature? At last the docstring for ZCacheable_invalidate is a bit misleading.
-- Maciej Wisniowski
participants (2)
-
Maciej Wisniowski -
Stefan H. Holek