Skip to main content

set_cache_owner

Function set_cache_owner 

Source
pub async fn set_cache_owner(owner: Option<String>)
Expand description

Tells the cache whose data it holds: the signed-in user’s id, or None when signed out. Call it whenever the signed-in user is known or changes, including on sign-out.

When the owner differs from the one the persistent store was written for, or is None, the whole cache (memory and store) is emptied, so one person never sees another’s lists on a shared device.

Until this is first called, the cache keeps everything in memory only. An app that never calls it is still safe, just without instant cold starts. A store written in an earlier run is still read on a cold start before this is called: it only ever holds the data of whoever was signed in last, and this empties it if that is no longer the case.