summary refs log tree commit diff
path: root/synapse/util
diff options
context:
space:
mode:
authorJason Little <realtyem@gmail.com>2023-06-14 03:42:18 -0500
committerGitHub <noreply@github.com>2023-06-14 09:42:18 +0100
commit21fea6b7493533985f7fa14924949514b5a356e2 (patch)
tree757eb51f5248c1f87218fc20e578d35d4c57a151 /synapse/util
parentDocument `looping_call()` functionality that will wait for the given function... (diff)
downloadsynapse-21fea6b7493533985f7fa14924949514b5a356e2.tar.xz
Prefill events after invalidate not before when persisting events (#15758)
Fixes #15757

Diffstat (limited to 'synapse/util')
-rw-r--r--synapse/util/caches/lrucache.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/synapse/util/caches/lrucache.py b/synapse/util/caches/lrucache.py
index 6137c85e10..be6554319a 100644
--- a/synapse/util/caches/lrucache.py
+++ b/synapse/util/caches/lrucache.py
@@ -842,7 +842,13 @@ class AsyncLruCache(Generic[KT, VT]):
         return self._lru_cache.get(key, update_metrics=update_metrics)
 
     async def set(self, key: KT, value: VT) -> None:
-        self._lru_cache.set(key, value)
+        # This will add the entries in the correct order, local first external second
+        self.set_local(key, value)
+        await self.set_external(key, value)
+
+    async def set_external(self, key: KT, value: VT) -> None:
+        # This method should add an entry to any configured external cache, in this case noop.
+        pass
 
     def set_local(self, key: KT, value: VT) -> None:
         self._lru_cache.set(key, value)