summary refs log tree commit diff
path: root/synapse/util/caches/deferred_cache.py
diff options
context:
space:
mode:
authorDavid Robertson <davidr@element.io>2021-09-22 14:21:58 +0100
committerGitHub <noreply@github.com>2021-09-22 14:21:58 +0100
commit724aef9a878cebc137c81f3b261bafb9302fb592 (patch)
tree3cb2a487de6407a2ce5e1991e6ca8945171d0f61 /synapse/util/caches/deferred_cache.py
parentExtend ModuleApi with the methods we'll need to reject spam based on …IP - ... (diff)
downloadsynapse-724aef9a878cebc137c81f3b261bafb9302fb592.tar.xz
Opt out of cache expiry for `get_users_who_share_room_with_user` (#10826)
* Allow LruCaches to opt out of time-based expiry
* Don't expire `get_users_who_share_room` & friends
Diffstat (limited to 'synapse/util/caches/deferred_cache.py')
-rw-r--r--synapse/util/caches/deferred_cache.py2
1 files changed, 2 insertions, 0 deletions
diff --git a/synapse/util/caches/deferred_cache.py b/synapse/util/caches/deferred_cache.py
index f05590da0d..6262efe072 100644
--- a/synapse/util/caches/deferred_cache.py
+++ b/synapse/util/caches/deferred_cache.py
@@ -73,6 +73,7 @@ class DeferredCache(Generic[KT, VT]):
         tree: bool = False,
         iterable: bool = False,
         apply_cache_factor_from_config: bool = True,
+        prune_unread_entries: bool = True,
     ):
         """
         Args:
@@ -105,6 +106,7 @@ class DeferredCache(Generic[KT, VT]):
             size_callback=(lambda d: len(d) or 1) if iterable else None,
             metrics_collection_callback=metrics_cb,
             apply_cache_factor_from_config=apply_cache_factor_from_config,
+            prune_unread_entries=prune_unread_entries,
         )
 
         self.thread: Optional[threading.Thread] = None