KeyedReplica
Keyed replica replicates multiple chunks of data - different chunks for different keys.
The difference between KeyedReplica and KeyedPhysicalReplica is that the latter has a richer API. KeyedReplica has minimalistic read-only API, whereas KeyedPhysicalReplica allows to cancel requests, modify data, execute optimistic updates.
Functions
Link copied to clipboard
abstract fun observe( observerCoroutineScope: CoroutineScope, observerActive: StateFlow<Boolean>, key: StateFlow<K?>): ReplicaObserver<T>
Content copied to clipboard
Starts to observe a keyed replica. Returned ReplicaObserver gives access to replica state and error events.
Link copied to clipboard
Loads fresh data from a network for a given key if it is stale.
Inheritors
Extensions
Link copied to clipboard
fun <K : Any, T : Any> KeyedReplica<K, T>.keepPreviousData(): KeyedReplica<K, T>
Content copied to clipboard
Modifies KeyedReplica so its observer keeps a data from a previous key until a data for a new key will not be loaded. It allows to dramatically improve UX when KeyedReplica is observed by changing keys.