Created
August 14, 2016 16:14
-
-
Save ragdroid/b7ac2eea118b031fb61a4d009b7b147b to your computer and use it in GitHub Desktop.
Concat() operator to hit the cache first - Droidcon 2016
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
//Concatify spell | |
Observable<List<Lecture>> getLectures() { | |
Observable<List<Lecture>> cacheObservable = getLecturesFromCache(); | |
Observable<List<Lecture>> lecturesFromServer = getLecturesFromServer(); | |
return cacheObservable.concatWith(lecturesFromServer) | |
.take(1); | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment