How do I update the cache without calling Retrofit?
yes, recently i have facing the same situation cuz i want to clear user account information without calling retrofit again. May I ask for any method to do so?
you have to evict the previous cached data, to do that, supply to the provider any dummy observable with an empty list or whatever representation that typified your "empty state".
An example:
getMocksFilteredEvict(Observable.just(emptyList()), new DynamicKey("yourKey"), new EvictDynamicKey(true)
.subscribe()
If you want a more flexible approach, use ReactiveCache
Dear author, I have tried to follow your method, such as the following code is my attempt.The result is that the data in the data field in the cache is set to empty.But once again, when I read the cache of the API, he returned the empty data directly to me without asking for new data.If I need new data, I must manually refresh it.Before that I thought that if I read an empty cache, I would automatically refresh the data.Is there any misunderstanding about how I use it?
Observable observable = Observable.just(new ArrayList());
RequestFactory.getStartCacheRequest().testCacheForOneClear(observable, new EvictProvider
(true)).subscribe();