Module matrix_sdk::event_cache

source ·
Expand description

The event cache is an abstraction layer, sitting between the Rust SDK and a final client, that acts as a global observer of all the rooms, gathering and inferring some extra useful information about each room. In particular, this doesn’t require subscribing to a specific room to get access to this information.

It’s intended to be fast, robust and easy to maintain.

See the github issue for more details about the historical reasons that led us to start writing this.

Most of it is still a work-in-progress, as of 2024-01-22.

The desired set of features it may eventually implement is the following:

  • compute proper unread room counts, and use backpagination to get missing messages/notifications/mentions, if needs be.
  • expose that information with a new data structure similar to the RoomInfo, and that may update a RoomListService.
  • provide read receipts for each message.
  • backwards pagination
  • [~] forward pagination
  • reconcile results with cached timelines.
  • retry decryption upon receiving new keys (from an encryption sync service or from a key backup).
  • expose the latest event for a given room.
  • caching of events on-disk.


  • The paginator is a stateful helper object that handles reaching an event, either from a cache or network, and surrounding events (“context”). Then, it makes it possible to paginate forward or backward, from that event, until one end of the timeline (front or back) is reached.



Type Aliases§