I am using the following observable to call retrofit api then save the response into cache file:
@Override public Observable<StoryCollectionEntity> storyEntityList(final int page) {
return this.restApi.storyCollection(id, page)
.doOnNext(saveStoryCollectionToCacheAction)
.onErrorResumeNext(CloudNewsDataStore.this.mNewsCache.getStories(page));
}
This works as expected. my question is: how can i make this observer returns api response periodically?
let's say, user wants to refresh the data every 5 minutes