summary refs log tree commit diff
path: root/synapse/push
diff options
context:
space:
mode:
authorDavid Baker <dave@matrix.org>2016-01-21 19:16:25 +0000
committerDavid Baker <dave@matrix.org>2016-01-21 19:16:25 +0000
commitf1f81221205cf2ec101f96234050569d6419fd6b (patch)
tree8cd4e21847d0c63ae70c869ac08575dcc441931e /synapse/push
parentMerge pull request #517 from matrix-org/erikj/push_only_room (diff)
downloadsynapse-f1f81221205cf2ec101f96234050569d6419fd6b.tar.xz
Change LRUCache to be tree-based so we can delete subtrees.
Diffstat (limited to 'synapse/push')
-rw-r--r--synapse/push/push_rule_evaluator.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/synapse/push/push_rule_evaluator.py b/synapse/push/push_rule_evaluator.py
index dca018af95..27b0de4f66 100644
--- a/synapse/push/push_rule_evaluator.py
+++ b/synapse/push/push_rule_evaluator.py
@@ -309,14 +309,14 @@ def _flatten_dict(d, prefix=[], result={}):
     return result
 
 
-regex_cache = LruCache(5000)
+regex_cache = LruCache(5000, 1)
 
 
 def _compile_regex(regex_str):
-    r = regex_cache.get(regex_str, None)
+    r = regex_cache.get((regex_str,), None)
     if r:
         return r
 
     r = re.compile(regex_str, flags=re.IGNORECASE)
-    regex_cache[regex_str] = r
+    regex_cache[(regex_str,)] = r
     return r