Skip to content

Instantly share code, notes, and snippets.

@VictorAlbertos
Created July 26, 2016 14:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save VictorAlbertos/adc0e0cfc0114b13307e53ccdb737e9b to your computer and use it in GitHub Desktop.
Save VictorAlbertos/adc0e0cfc0114b13307e53ccdb737e9b to your computer and use it in GitHub Desktop.
//read from loader
api
.compose(rxCache.<User>.read("mock").toObservable())
.subscribe();
//read without loader
RxCache.<User>.read("mock")
.toObservable()
.subscribe();
//add
Observable.just(mock)
.compose(rxCache.<User>.read("mock")
.evict(true)
.fromObservable())
.subscribe();
//update
rxCache.<Mock>read("mock")
.toObservable()
.map(user -> {
user.setMessage("hola");
return user;
})
.compose(rxCache.<Mock>read("mock")
.evict(true)
.fromObservable())
.subscribe(subscriber);
//remove
rxCache.<Mock>read("mock")
.toObservable()
.map(user -> null)
.compose(rxCache.<Mock>read("mock").evict(true)
.fromObservable())
.subscribe(subscriber);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment