abstract class LocalRepository<CACHE : Any, GET_CACHE_REQUIREMENTS : GetCacheRequirements>
Teller repository that manages cache that is obtained and stored on the local device.
Using LocalRepository is quite simple:
LocalRepository is thread safe. Actions called upon for LocalRepository can be performed on any thread.
interface GetCacheRequirements |
LocalRepository() |
var requirements: GET_CACHE_REQUIREMENTS? |
fun dispose(): Unit
Dispose of the LocalRepository to shut down observing of cached data. |
|
abstract fun isCacheEmpty(cache: CACHE, requirements: GET_CACHE_REQUIREMENTS): Boolean
Determines if cache is empty or not. This is used internally by Teller to determine if the cache from observeCache is empty or not to then pass to LocalDataState.deliverState with the state of the cache. |
|
fun newCache(cache: CACHE, requirements: GET_CACHE_REQUIREMENTS): Unit
Save new cache data. |
|
fun observe(): Observable<LocalDataState<CACHE>>
Get an observable that gets the current state of data and all future states. |
|
abstract fun observeCache(requirements: GET_CACHE_REQUIREMENTS): Observable<CACHE>
This function should be setup to trigger anytime there is a data change. So if you were to call saveCache, anyone observing the Observable returned here will get notified of a new update. |
|
abstract fun saveCache(cache: CACHE, requirements: GET_CACHE_REQUIREMENTS): Unit
Save new cache data to whatever storage method Repository chooses. |