summary refs log tree commit diff
path: root/synapse/util/caches
diff options
context:
space:
mode:
authorDavid Baker <dave@matrix.org>2016-01-22 11:49:59 +0000
committerDavid Baker <dave@matrix.org>2016-01-22 11:49:59 +0000
commit5b142788d22fc5c225b4897a914ddf96cfd6a1f0 (patch)
tree5df929fb067e4edd5c94c6e46b02ce3c5745179f /synapse/util/caches
parentDocs for treecache (diff)
downloadsynapse-5b142788d22fc5c225b4897a914ddf96cfd6a1f0.tar.xz
Add __contains__
Diffstat (limited to '')
-rw-r--r--synapse/util/caches/treecache.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/synapse/util/caches/treecache.py b/synapse/util/caches/treecache.py
index 2d014e1f92..3b58860910 100644
--- a/synapse/util/caches/treecache.py
+++ b/synapse/util/caches/treecache.py
@@ -13,6 +13,9 @@ class TreeCache(object):
     def __setitem__(self, key, value):
         return self.set(key, value)
 
+    def __contains__(self, key):
+        return self.get(key, SENTINEL) is not SENTINEL
+
     def set(self, key, value):
         node = self.root
         for k in key[:-1]: