Slide 10
Slide 10 text
public Observable scan(long timespan, TimeUnit unit,
Scheduler scheduler) {
return scanner.startScan()
.filter(result -> !cache.isCached(result))
.flatMap(cache::put)
.buffer(timespan, unit, scheduler)
.filter(results -> !results.isEmpty())
.flatMap(this::checkAvailability)
.doOnSubscribe(() -> cache.removeAll().subscribe());
}