I have the following java code to build a Guava cache:
myCache = CacheBuilder.newBuilder()
.build(new CacheLoader<Result, String>() {
@Override
public Result load(String s) throws Exception {
Result result = getResult(s);
// if (result == Result.INVALID) return ???
return result;
}
}
);
I would like to add some code whereby if the result is a specific value then nothing is loaded into the cache. Not sure how to do it. Any suggestions? Many thanks!