Replace DeferredCache with LruCache where possible (#8563)

Most of these uses don't need a full-blown DeferredCache; LruCache is lighter and more appropriate.
This commit is contained in:
Richard van der Hoff 2020-10-19 12:20:29 +01:00 committed by GitHub
parent 79c1f973ce
commit 97647b33c2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 30 additions and 27 deletions

View file

@ -76,14 +76,16 @@ class SQLBaseStore(metaclass=ABCMeta):
"""
try:
if key is None:
getattr(self, cache_name).invalidate_all()
else:
getattr(self, cache_name).invalidate(tuple(key))
cache = getattr(self, cache_name)
except AttributeError:
# We probably haven't pulled in the cache in this worker,
# which is fine.
pass
return
if key is None:
cache.invalidate_all()
else:
cache.invalidate(tuple(key))
def db_to_json(db_content):