summary refs log tree commit diff
path: root/synapse/util/caches/lrucache.py
diff options
context:
space:
mode:
authorRichard van der Hoff <1389908+richvdh@users.noreply.github.com>2020-10-19 12:20:29 +0100
committerGitHub <noreply@github.com>2020-10-19 12:20:29 +0100
commit97647b33c248f25571bae617365d95434e6a3d5f (patch)
tree044641744fc53b9af803f6adb9b914eaa7083f43 /synapse/util/caches/lrucache.py
parentPre-emptively fix synapse.storage.types.Connection for future mypy release (#... (diff)
downloadsynapse-97647b33c248f25571bae617365d95434e6a3d5f.tar.xz
Replace DeferredCache with LruCache where possible (#8563)
Most of these uses don't need a full-blown DeferredCache; LruCache is lighter and more appropriate.
Diffstat (limited to 'synapse/util/caches/lrucache.py')
-rw-r--r--synapse/util/caches/lrucache.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/synapse/util/caches/lrucache.py b/synapse/util/caches/lrucache.py
index 4e95dd9bf3..3b471d8fd3 100644
--- a/synapse/util/caches/lrucache.py
+++ b/synapse/util/caches/lrucache.py
@@ -337,6 +337,9 @@ class LruCache(Generic[KT, VT]):
         self.set = cache_set
         self.setdefault = cache_set_default
         self.pop = cache_pop
+        # `invalidate` is exposed for consistency with DeferredCache, so that it can be
+        # invalidated by the cache invalidation replication stream.
+        self.invalidate = cache_pop
         if cache_type is TreeCache:
             self.del_multi = cache_del_multi
         self.len = synchronized(cache_len)