Skip to content
This repository was archived by the owner on Apr 26, 2024. It is now read-only.

Commit 7c5aae5

Browse files
committed
Merge pull request #6506 from matrix-org/erikj/remove_snapshot_cache
* commit 'e3f528c54': Newsfile Remove SnapshotCache in favour of ResponseCache
2 parents 945c30e + e3f528c commit 7c5aae5

File tree

4 files changed

+9
-168
lines changed

4 files changed

+9
-168
lines changed

changelog.d/6506.misc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Remove `SnapshotCache` in favour of `ResponseCache`.

synapse/handlers/initial_sync.py

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
from synapse.types import StreamToken, UserID
2727
from synapse.util import unwrapFirstError
2828
from synapse.util.async_helpers import concurrently_execute
29-
from synapse.util.caches.snapshot_cache import SnapshotCache
29+
from synapse.util.caches.response_cache import ResponseCache
3030
from synapse.visibility import filter_events_for_client
3131

3232
from ._base import BaseHandler
@@ -41,7 +41,7 @@ def __init__(self, hs):
4141
self.state = hs.get_state_handler()
4242
self.clock = hs.get_clock()
4343
self.validator = EventValidator()
44-
self.snapshot_cache = SnapshotCache()
44+
self.snapshot_cache = ResponseCache(hs, "initial_sync_cache")
4545
self._event_serializer = hs.get_event_client_serializer()
4646
self.storage = hs.get_storage()
4747
self.state_store = self.storage.state
@@ -79,17 +79,14 @@ def snapshot_all_rooms(
7979
as_client_event,
8080
include_archived,
8181
)
82-
now_ms = self.clock.time_msec()
83-
result = self.snapshot_cache.get(now_ms, key)
84-
if result is not None:
85-
return result
8682

87-
return self.snapshot_cache.set(
88-
now_ms,
83+
return self.snapshot_cache.wrap(
8984
key,
90-
self._snapshot_all_rooms(
91-
user_id, pagin_config, as_client_event, include_archived
92-
),
85+
self._snapshot_all_rooms,
86+
user_id,
87+
pagin_config,
88+
as_client_event,
89+
include_archived,
9390
)
9491

9592
@defer.inlineCallbacks

synapse/util/caches/snapshot_cache.py

Lines changed: 0 additions & 94 deletions
This file was deleted.

tests/util/test_snapshot_cache.py

Lines changed: 0 additions & 63 deletions
This file was deleted.

0 commit comments

Comments
 (0)