mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-08-08 04:02:16 -04:00
Change LRUCache to be tree-based so we can delete subtrees.
This commit is contained in:
parent
297eded261
commit
f1f8122120
7 changed files with 140 additions and 52 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue