Save and restore event cache to/from persistent storage
Now that a user's login session is properly persisted to/from storage on all platforms, the next step is to:
- Serialize the actual set of all timeline events (as a list of
SyncTimelineEvents) upon app exit, or perhaps upon another lifecycle stage. - Deserialize them and repopulate the event cache before synchronizing any timelines, using the
EventCache::add_initial_events()- We just removed an erroneous invocation of this function in fde5d29711363f49fdc3503125a90522bffac677
This is blocked on the Matrix Rust SDK, which currently doesn't fully implement EventCache features that allow the client to customize how events are extracted from and imported into the cache.
Hmm, actually it appears that the SDK might support this, at least in part, by using the ClientBuilder to configure a client to use an existing state store and cache path.
https://matrix-org.github.io/matrix-rust-sdk/matrix_sdk/struct.ClientBuilder.html#method.sqlite_store_with_cache_path
However, that being said, I haven't tried it yet and am not sure if pointing a Client at an existing database & cache in the filesystem will actually cause the SDK to pull in those old events into the Client's EventCache or have them initially populate the rooms & timelines.