diff options
author | Erik Johnston <erik@matrix.org> | 2022-07-15 16:24:10 +0100 |
---|---|---|
committer | Erik Johnston <erik@matrix.org> | 2022-07-15 16:24:10 +0100 |
commit | 602a81f5a2098ca29e9ffb89cf13d12471884854 (patch) | |
tree | bf36178db1af5a038b5fd986858b5cb68c18a88d | |
parent | Fix test (diff) | |
download | synapse-602a81f5a2098ca29e9ffb89cf13d12471884854.tar.xz |
don't update access
-rw-r--r-- | synapse/util/caches/dictionary_cache.py | 5 | ||||
-rw-r--r-- | synapse/util/caches/lrucache.py | 4 |
2 files changed, 7 insertions, 2 deletions
diff --git a/synapse/util/caches/dictionary_cache.py b/synapse/util/caches/dictionary_cache.py index 810b8bb716..4e5a96b5b4 100644 --- a/synapse/util/caches/dictionary_cache.py +++ b/synapse/util/caches/dictionary_cache.py @@ -165,7 +165,10 @@ class DictionaryCache(Generic[KT, DKT, DV]): return DictionaryEntry(False, known_absent, values) entry = self.cache.get( - (key, _FullCacheKey.KEY), _Sentinel.sentinel, update_metrics=False + (key, _FullCacheKey.KEY), + _Sentinel.sentinel, + update_metrics=False, + update_last_access=False, ) if entry is _Sentinel.sentinel: return DictionaryEntry(False, known_absent, values) diff --git a/synapse/util/caches/lrucache.py b/synapse/util/caches/lrucache.py index b2b999cd60..aab0d1c7e2 100644 --- a/synapse/util/caches/lrucache.py +++ b/synapse/util/caches/lrucache.py @@ -559,10 +559,12 @@ class LruCache(Generic[KT, VT]): default: Optional[T] = None, callbacks: Collection[Callable[[], None]] = (), update_metrics: bool = True, + update_last_access: bool = True, ) -> Union[None, T, VT]: node = cache.get(key, None) if node is not None: - move_node_to_front(node) + if update_last_access: + move_node_to_front(node) node.add_callbacks(callbacks) if update_metrics and metrics: metrics.inc_hits() |