咖啡因缓存手动填充示例中的未知类和方法

时间:2017-10-22 23:08:24

标签: caching caffeine

Caffeine Cache手动填充示例中的Graph类和createExpensiveGraph()方法是什么:

Cache<Key, Graph> cache = Caffeine.newBuilder()
    .expireAfterWrite(10, TimeUnit.MINUTES)
    .maximumSize(10_000)
    .build();
// Lookup an entry, or null if not found
Graph graph = cache.getIfPresent(key);
// Lookup and compute an entry if absent, or null if not computable
graph = cache.get(key, k -> createExpensiveGraph(key));
// Insert or update an entry
cache.put(key, graph);
// Remove an entry
cache.invalidate(key);

https://github.com/ben-manes/caffeine/wiki/Population

0 个答案:

没有答案