@Test public void getSingularCompletesWithNoEmissionsWhenCacheIsEmpty() { cache.getSingular("KEY").test().assertNoValues(); }
@Override @NonNull public Maybe<Value> getSingular(@NonNull final Key key) { return Maybe.fromCallable(() -> cache.containsKey(key)) .filter(isPresent -> isPresent) .map(__ -> cache.get(key)) .filter(this::notExpired) .map(CacheEntry::cachedObject) .subscribeOn(Schedulers.computation()); }
Cache implements MemoryStore<Key, Value> { @Override @NonNull public Maybe<Value> getSingular(@NonNull final Key key) { return Maybe.fromCallable(() -> cache.containsKey(key)) .filter(isPresent -> isPresent) .map(__ -> cache.get(key)) .filter(this::notExpired) .map(CacheEntry::cachedObject) .subscribeOn(Schedulers.computation()); } }
Cache implements MemoryStore<Key, Value> { @Override @NonNull public Maybe<Value> getSingular(@NonNull final Key key) { return Maybe.fromCallable(() -> cache.containsKey(key)) .filter(isPresent -> isPresent) .map(__ -> cache.get(key)) .filter(this::notExpired) .map(CacheEntry::cachedObject) .subscribeOn(Schedulers.computation()); } Cache(@NonNull final Function<Value, Key> extractKeyFromModel,
                 @NonNull final TimestampProvider timestampProvider);  Cache(@NonNull final Function<Value, Key> extractKeyFromModel,
                 @NonNull final TimestampProvider timestampProvider,
                 final long timeoutMs); private  Cache(@NonNull final Function<Value, Key> extractKeyFromModel,
                  @NonNull final TimestampProvider timestampProvider,
                  @NonNull final Option<Long> timeoutMs); }
Cache implements MemoryStore<Key, Value> { @Override @NonNull public Maybe<Value> getSingular(@NonNull final Key key) { return Maybe.fromCallable(() -> cache.containsKey(key)) .filter(isPresent -> isPresent) .map(__ -> cache.get(key)) .filter(this::notExpired) .map(CacheEntry::cachedObject) .subscribeOn(Schedulers.computation()); } Cache(@NonNull final Function<Value, Key> extractKeyFromModel,
                 @NonNull final TimestampProvider timestampProvider);  Cache(@NonNull final Function<Value, Key> extractKeyFromModel,
                 @NonNull final TimestampProvider timestampProvider,
                 final long timeoutMs); private  Cache(@NonNull final Function<Value, Key> extractKeyFromModel,
                  @NonNull final TimestampProvider timestampProvider,
                  @NonNull final Option<Long> timeoutMs); @Override void putSingular(@NonNull Value value); @Override void putAll(@NonNull List<Value> values); @Override @NonNull Maybe<Value> getSingular(@NonNull final Key key); @Override @NonNull Maybe<List<Value>> getAll(); @Override void clear(); }
Cache implements MemoryStore<Key, Value> { @Override @NonNull public Maybe<Value> getSingular(@NonNull final Key key) { return Maybe.fromCallable(() -> cache.containsKey(key)) .filter(isPresent -> isPresent) .map(__ -> cache.get(key)) .filter(this::notExpired) .map(CacheEntry::cachedObject) .subscribeOn(Schedulers.computation()); } Cache(@NonNull final Function<Value, Key> extractKeyFromModel,
                 @NonNull final TimestampProvider timestampProvider);  Cache(@NonNull final Function<Value, Key> extractKeyFromModel,
                 @NonNull final TimestampProvider timestampProvider,
                 final long timeoutMs); private  Cache(@NonNull final Function<Value, Key> extractKeyFromModel,
                  @NonNull final TimestampProvider timestampProvider,
                  @NonNull final Option<Long> timeoutMs); @Override void putSingular(@NonNull Value value); @Override void putAll(@NonNull List<Value> values); @Override @NonNull Maybe<Value> getSingular(@NonNull final Key key); @Override @NonNull Maybe<List<Value>> getAll(); @Override void clear();  }