基于 Guava 实现 dict 字典数据的本地缓存

This commit is contained in:
YunaiV
2022-06-17 19:50:57 +08:00
parent 0045602e6b
commit 31c24cd340
22 changed files with 209 additions and 322 deletions

View File

@@ -19,7 +19,7 @@ public class CacheUtils {
// 只阻塞当前数据加载线程,其他线程返回旧值
.refreshAfterWrite(duration)
// 通过 asyncReloading 实现全异步加载,包括 refreshAfterWrite 被阻塞的加载线程
.build(CacheLoader.asyncReloading(loader, Executors.newSingleThreadExecutor()));
.build(CacheLoader.asyncReloading(loader, Executors.newCachedThreadPool())); // TODO 芋艿:可能要思考下,未来要不要做成可配置
}
}