[Zope-dev] zpatterns: how to invalidate the attribute cache?

Phillip J. Eby pje@telecommunity.com
Thu, 10 Aug 2000 09:52:54 -0500


At 05:23 PM 8/10/00 +0400, Jephte CLAIN wrote:
>Hello,
>
>I feel a need to invalidate a dataskin attribute cache after it has been
>edited, because other objects might want to use the just modified
>dataskin, but with the new values.
>Of course, these values come from some attribute providers that should
>be re-queried.

This should not be necessary.  Note that both __set_attr__ and __del_attr__
call self._objectChanging('name') which invalidates the cache entry for
'name'.  If you are changing the object in some other way via Python such
that neither __set_attr__ nor __del_attr__ are being called, you should
call _objectChanging('attrname') in order to ensure that change events get
fired properly and the cache for the attribute is invalidated.

I don't see a need for a mass invalidation operation, just more
documentation on these inner workings.  :)