mirror of
https://github.com/element-hq/synapse.git
synced 2026-11-05 13:17:54 +00:00
The Rust `Cache` bounded itself by entry count, through `lru`'s capacity. The state resolution caches need a bound on the sum of what their values weigh: a state map counts for its entries, a chain's links for each link, as Python's `size_callback` caches do. So the bound is now a weight, with a `Weigher` chosen at construction and the default weighing every value as one, and the cache enforces it itself over an unbounded `lru`. Those caches are also filled by readers that load a batch of keys in one statement rather than through `get_or_load`, so `Cache::insert` is now public, with `prefill` semantics: it leaves any in-flight load for the key to answer its waiters and cache what it found. A cache key that is a single string or integer now decodes from Python, as the keys of the caches moving here are event IDs and group IDs. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0194eNQP5weBtVMg8NKtc6VU