cubicweb/server/repository.py
changeset 12061 94ae25593c38
parent 12060 0cdf5fafd234
child 12062 601d65193619
--- a/cubicweb/server/repository.py	Fri Mar 03 13:09:11 2017 +0100
+++ b/cubicweb/server/repository.py	Wed Mar 15 08:30:27 2017 +0100
@@ -660,17 +660,23 @@
     # * correspondance between eid and type
     # * correspondance between eid and local id (i.e. specific to a given source)
 
-    def clear_caches(self, eids):
-        etcache = self._type_cache
-        rqlcache = self.querier.rql_cache
-        for eid in eids:
-            try:
-                etype = etcache.pop(int(eid))  # may be a string in some cases
-                rqlcache.pop(('%s X WHERE X eid %s' % (etype, eid),), None)
-            except KeyError:
-                etype = None
-            rqlcache.pop(('Any X WHERE X eid %s' % eid,), None)
-            self.system_source.clear_eid_cache(eid, etype)
+    def clear_caches(self, eids=None):
+        if eids is None:
+            self._type_cache = {}
+            etypes = None
+        else:
+            etypes = []
+            etcache = self._type_cache
+            rqlcache = self.querier.rql_cache
+            for eid in eids:
+                try:
+                    etype = etcache.pop(int(eid))  # may be a string in some cases
+                    rqlcache.pop(('%s X WHERE X eid %s' % (etype, eid),), None)
+                except KeyError:
+                    etype = None
+                rqlcache.pop(('Any X WHERE X eid %s' % eid,), None)
+                etypes.append(etype)
+        self.system_source.clear_caches(eids, etypes)
 
     def type_from_eid(self, eid, cnx):
         """Return the type of the entity with id `eid`"""