diff options
author | David Baker <dave@matrix.org> | 2016-01-21 19:16:25 +0000 |
---|---|---|
committer | David Baker <dave@matrix.org> | 2016-01-21 19:16:25 +0000 |
commit | f1f81221205cf2ec101f96234050569d6419fd6b (patch) | |
tree | 8cd4e21847d0c63ae70c869ac08575dcc441931e /synapse/push | |
parent | Merge pull request #517 from matrix-org/erikj/push_only_room (diff) | |
download | synapse-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.py | 6 |
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 |