Files
synapse/tests
Matthew Hodgson c159933058 Cache room hierarchy summaries, invalidated when the underlying data changes
Two new caches serve the room hierarchy (space summary) endpoints without
touching the database once warm:

* get_room_hierarchy_state (state store): the room's authoritative join
  rule and history visibility, the join-rules state id (for the
  restricted-allow computation) and the stripped m.space.child events.
  Invalidated whenever a state event is persisted in the room (and on
  room purge), including over replication.

* get_room_with_stats (room store) is now @cached, invalidated where the
  room stats rows are written (update_room_state and the room stats
  delta), when the room's directory visibility changes, and on purge.

The handler serves local room entries from these caches; accessibility
checks use the cached authoritative join rule / history visibility plus
the existing per-user cached membership lookups, so a warm request for a
public hierarchy does no DB work. Partial-state and unknown rooms fall
back to the uncached path.

Join rule and history visibility for access decisions are read from
current state, not the stats copies, so access control never rides a
stale asynchronously-updated stats row. Remote rooms were already
TTL-cached by the federation client (5 minutes); change-based
invalidation is not possible across federation.

Ties in child ordering beyond origin_server_ts now break on the child
room id (per MSC2946) rather than the previously arbitrary input order.
2026-08-08 21:37:15 +03:00
..
2026-06-02 11:05:38 +01:00