Created
November 15, 2016 20:55
-
-
Save ragdroid/c57471d96f9cadbf6cf6035eac541f66 to your computer and use it in GitHub Desktop.
Hit Network first and the cache
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
service.startupDetails(request) | |
.doOnNext(new Action1<StartupDetails>() { | |
@Override | |
public void call(StartupDetails startupDetails) { | |
startupStore.putStartupDetails(startupDetails); | |
} | |
}) | |
.onErrorReturn(new Function<Throwable, StartupDetails>() { | |
@Override | |
public StartupDetails apply(Throwable throwable) { | |
//fetching startup details failed, will return cached value" | |
return getStartupDetailsFromCache(); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment