diff --git a/synapse/storage/databases/state/store.py b/synapse/storage/databases/state/store.py
index afbc85ad0c..0e38e5b5e4 100644
--- a/synapse/storage/databases/state/store.py
+++ b/synapse/storage/databases/state/store.py
@@ -202,7 +202,11 @@ class StateGroupDataStore(StateBackgroundUpdateStore, SQLBaseStore):
requests state from the cache, if False we need to query the DB for the
missing state.
"""
- cache_entry = cache.get(group)
+ dict_keys = None
+ if not state_filter.has_wildcards():
+ dict_keys = state_filter.concrete_types()
+
+ cache_entry = cache.get(group, dict_keys=dict_keys)
state_dict_ids = cache_entry.value
if cache_entry.full or state_filter.is_full():
diff --git a/synapse/util/caches/dictionary_cache.py b/synapse/util/caches/dictionary_cache.py
index 4e5a96b5b4..869a267e94 100644
--- a/synapse/util/caches/dictionary_cache.py
+++ b/synapse/util/caches/dictionary_cache.py
@@ -126,7 +126,8 @@ class DictionaryCache(Generic[KT, DKT, DV]):
return DictionaryEntry(True, set(), entry)
all_entries = self.cache.get_multi(
- (key,), _Sentinel.sentinel, update_metrics=False
+ (key,),
+ _Sentinel.sentinel,
)
if all_entries is _Sentinel.sentinel:
return DictionaryEntry(False, set(), {})
@@ -167,7 +168,6 @@ class DictionaryCache(Generic[KT, DKT, DV]):
entry = self.cache.get(
(key, _FullCacheKey.KEY),
_Sentinel.sentinel,
- update_metrics=False,
update_last_access=False,
)
if entry is _Sentinel.sentinel:
|