in simplestore/src/main/java/com/uber/simplestore/impl/SimpleStoreImpl.java [103:128]
public ListenableFuture<byte[]> get(String key) {
requireOpen();
return Futures.submitAsync(
() -> {
Exception isDead = isDead();
if (isDead != null) {
return Futures.immediateFailedFuture(isDead);
}
byte[] value;
if (cache.containsKey(key)) {
value = cache.get(key);
} else {
try {
value = readFile(key);
} catch (IOException e) {
return Futures.immediateFailedFuture(e);
}
if (value == null || value.length == 0) {
value = EMPTY_BYTES;
}
cache.put(key, value);
}
return Futures.immediateFuture(value);
},
orderedIoExecutor);
}