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

Jephte CLAIN Jephte.Clain@univ-reunion.fr
Thu, 10 Aug 2000 17:23:19 +0400


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.

Any thoughts? It seems that the only way is to redefine _v_attrCache.
Please comment this patch:

--- DataSkins.py.orig   Thu Aug 10 17:20:53 2000
+++ DataSkins.py        Thu Aug 10 17:21:47 2000
@@ -97,6 +97,11 @@
         """Return attribute cache"""
         return self._v_attrCache
 
+    def _invalidateCache(self):
+        """invalidate the current attribute cache"""
+        v = self._v_attrCache = {}
+        return v
+
     def _v_readableSlot(self,_v_dm_=_v_dm_):
         return
self.__dict__[_v_dm_]._readableSlotFor(self)                                     

regards,
jephte.clain@univ-reunion.fr