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

2006-11-19 Thread Stefan H. Holek
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


___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
http://mail.zope.org/mailman/listinfo/zope-announce

http://mail.zope.org/mailman/listinfo/zope-dev )


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

2006-11-19 Thread Maciej Wisniowski
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

___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )