[Zope] OFS.Cache.Cacheable.ZCacheable_invalidate and view_name

Maciej Wisniowski maciej.wisniowski at coig.katowice.pl
Sun Nov 19 07:46:23 EST 2006


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



More information about the Zope mailing list