Closed NaSOS closed 4 years ago
By enabling useExpiredDataWhenNoLoaderAvailabe
you're not preventing evicting data if the limit for storing it has been reached. What you're doing is allowing to fallback to expired data when the loader returns no data (an error).
So if you want to achieve that behaviour just configure the limit in megabytes for the data to be persisted.
By default, RxCache sets the limit in 100 megabytes, but you can change this value by calling setMaxMBPersistenceCache method when building the provider instance.
new RxCache.Builder()
.setMaxMBPersistenceCache(maxMgPersistenceCache)
First of all thanks for the answer. I've already read about the cache size limit but currently I am just caching a couple or requests that sum up to some Kilobytes so this is not the issue here.
Please keep in mind that while using the app and reloading the same data the mechanism works perfect and nothing gets evicted. The issue occurs when I kill and re-launch the app.
@VictorAlbertos I know that this has been answered before but I would like you to elaborate a bit on it again.
Although I have enabled the
useExpiredDataWhenNoLoaderAvailabe
when I launch the app theProcessorProvidersBehaviour
starts theEvictExpiredRecordsPersistence
and my expired data are being evicted and thus, I get theRxCacheException: The Loader provided did not return any data and there is not data to load from the Cache
error.I think that this is misleading since I would expect to always have data in my cache (since I have loaded them at least once of course) and just refresh them whenever possible. So I think it would be better to not evict expired records on app launch when
useExpiredDataWhenNoLoaderAvailabe
.