guavaはローカルキャッシュを実現します。
3390 ワード
private static LoadingCache cache =
//CacheBuilder , newBuilder() CacheBuilder
CacheBuilder.newBuilder()
// 8,
.concurrencyLevel(8)
// 30
.expireAfterWrite(30, TimeUnit.MINUTES)
// 10
.initialCapacity(10)
// 100, 100 LRU
.maximumSize(100)
//
.recordStats()
//
.removalListener(new RemovalListener
)0public static void main(String[] args) throws ExecutionException {
String s = cache.get("Hi");
System.out.println(s);
}