@NonNull public final Request<LazyEntry<T>> getLazy() { return Request.from( getInternal() .map( new Func1<Entry<T>, LazyEntry<T>>() { @Override public LazyEntry<T> call(Entry<T> entry) { return LazyEntry.cast(entry); } })); }
@NonNull public final Request<Entry<T>> get() { return Request.from( getInternal() .map( new Func1<Entry<T>, Entry<T>>() { @Override public Entry<T> call(Entry<T> entry) { if (entry != null) { // Fully read lazy entry, and return a copy return Entry.Builder.copy(entry); } return null; } })); }
@NonNull public final Request<LazyEntry<T>> getLazy(@NonNull final EntryPredicate<T> predicate) { Observable<LazyEntry<T>> observable = getLazy() .asObservable() .filter( new Func1<LazyEntry<T>, Boolean>() { @Override public Boolean call(LazyEntry<T> lazyEntry) { boolean keep = !predicate.isExpired(lazyEntry); if (!keep) { Util.closeQuietly(lazyEntry); } return keep; } }) .defaultIfEmpty(null); return Request.from(observable); }
@NonNull public final Request<Boolean> remove() { return Request.from(worker.remove()); }
@NonNull public final Request<T> put(@NonNull final Entry<T> entry) { return Request.from(worker.put(entry)); }