I'd like to use guavas CacheBuilder, but cannot find any explicit example how implement this.
The docs state the following code:
LoadingCache<Key, Graph> graphs = CacheBuilder.newBuilder()
.maximumSize(1000)
.build(
new CacheLoader<Key, Graph>() {
public Graph load(Key key) throws AnyException {
return createExpensiveGraph(key);
}
});
Question: what is this createExpensiveGraph(key) method? Is this a method that returns a HashMap<Key, Value> mapping? What do I have to do with the key value?
Or could I also just return a List<String> in this method not having to use the key value in any way?