[cubicweb/utils] add QueryCache.__contains__() to improve dict-like behavior. Closes #255426
authorNicolas Chauvat <nicolas.chauvat@logilab.fr>
Tue, 05 Nov 2019 23:19:15 +0100
changeset 12753 38d24fb2ae48
parent 12752 3cf37ec616ad
child 12754 22ece66dcd47
[cubicweb/utils] add QueryCache.__contains__() to improve dict-like behavior. Closes #255426
cubicweb/utils.py
--- a/cubicweb/utils.py	Thu May 23 00:33:31 2019 +0200
+++ b/cubicweb/utils.py	Tue Nov 05 23:19:15 2019 +0100
@@ -616,6 +616,9 @@
         self._data = {}
         self._lock = Lock()
 
+    def __contains__(self, key):
+        return key in self._data
+
     def __len__(self):
         with self._lock:
             return len(self._data)