mirror of
https://github.com/element-hq/synapse.git
synced 2026-11-05 02:27:46 +00:00
The sync store's caches are copies of `@cached` functions of the datastore, and those are invalidated by several paths: a write on the process, the caches stream, and the current state batch. Rather than tap each path, a `DeferredCache` now takes mirrors, invalidated with its own keys whenever it is, and `mirror_rust_cache` attaches a Rust cache as one, passing the key as the tuple of arguments. A `tree=True` cache is invalidated by a prefix of its key as well, so the Rust cache gains `invalidate_matching`, which drops every entry whose key satisfies a test, and a key type can decode a prefix into one. A key of two strings, such as room and user, does. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0194eNQP5weBtVMg8NKtc6VU