summary refs log tree commit diff
path: root/synapse/util
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2015-04-07 18:05:39 +0100
committerErik Johnston <erik@matrix.org>2015-04-07 18:05:39 +0100
commit4fe95094d1aa9a8a36a32c56d5665ddba825e029 (patch)
treed7e88a7b2ce0d41403c7a7afaff3b44088e60324 /synapse/util
parentRetry on deadlock (diff)
parentupdate leo's contribs a bit (diff)
downloadsynapse-4fe95094d1aa9a8a36a32c56d5665ddba825e029.tar.xz
Merge branch 'develop' of github.com:matrix-org/synapse into mysql
Diffstat (limited to 'synapse/util')
-rw-r--r--synapse/util/lrucache.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/synapse/util/lrucache.py b/synapse/util/lrucache.py
index 65d5792907..2f7b615f78 100644
--- a/synapse/util/lrucache.py
+++ b/synapse/util/lrucache.py
@@ -90,12 +90,16 @@ class LruCache(object):
         def cache_len():
             return len(cache)
 
+        def cache_contains(key):
+            return key in cache
+
         self.sentinel = object()
         self.get = cache_get
         self.set = cache_set
         self.setdefault = cache_set_default
         self.pop = cache_pop
         self.len = cache_len
+        self.contains = cache_contains
 
     def __getitem__(self, key):
         result = self.get(key, self.sentinel)
@@ -114,3 +118,6 @@ class LruCache(object):
 
     def __len__(self):
         return self.len()
+
+    def __contains__(self, key):
+        return self.contains(key)