Skip to content

Instantly share code, notes, and snippets.

@yemyatthu1990
Last active February 9, 2017 00:50
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 yemyatthu1990/036701e5b54bfe99355adea0d1b7868b to your computer and use it in GitHub Desktop.
Save yemyatthu1990/036701e5b54bfe99355adea0d1b7868b to your computer and use it in GitHub Desktop.
public class TownshipCloudDataStore implements TownshipDataStore {
private final TownshipCache townshipCache;
TownshipCloudDataStore(TownshipCache townshipCache){
this.townshipCache = townshipCache;
}
@Override
public Observable<List<TownshipEntity>> townships() {
return ServiceGenerator.getTownshipService().getTownships().doOnNext(new Consumer<List<TownshipEntity>>() {
@Override
public void accept(final List<TownshipEntity> townshipEntities) throws Exception {
townshipCache.put(townshipEntities);
}
});
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment