I was able to make RxCache with retrofit work by creating a provider which matches the return type of the retrofit api interface. However, if i first transform the API output to another Observable and try to cache on it, the cache only returns the first object in the stream.
I have a function in my repository like this:
public Observable<FeaturedUserRecord> getFeaturedUsersFromService(boolean forceAPIReload) {
Log.v(TAG, "Trying to getFeaturedUsersFromService");
final Observable<FeaturedUsersResponse> output = apiService.getFeaturedUsers();
final Observable<FeaturedUserRecord> result = output.flatMapIterable(listRest -> listRest.getData())
.map(apiEntity -> transformer.transform(apiEntity));
return result;
}
I want to cache on the return value of the function instead on the return value of the apiService. Therefore, i created a provider like:
The first time data is loaded, it sends all the records received from the api. However, the cache only returns the first value of the observable stream on subsequent refreshes.
I was able to make RxCache with retrofit work by creating a provider which matches the return type of the retrofit api interface. However, if i first transform the API output to another
Observable
and try to cache on it, the cache only returns the first object in the stream.I have a function in my repository like this:
I want to cache on the return value of the function instead on the return value of the apiService. Therefore, i created a provider like:
The first time data is loaded, it sends all the records received from the api. However, the cache only returns the first value of the observable stream on subsequent refreshes.