1、AsyncLoadingCache,异步Cache,
private AsyncLoadingCache
<String, String> cache
= Caffeine
.newBuilder()
.expireAfterWrite(Duration
.ofMillis(1000))
.buildAsync(this::buildCacheFunction
);
含义是我们每一次调用get的时候会传入key,传入key之后会通过buildCacheFunction函数来计算出当前key的value,再放入Cache中,在expireAfterWrite指定的时间之后,数据过期,在调用get还需要重新compute