Commit e28b786f by 王祖波

移除缓存

parent 4193a09c
......@@ -44,6 +44,12 @@ public class ImageCombined {
private static final Cache<String, BufferedImage> imageCache = Caffeine.newBuilder()
.maximumWeight(100 * 1024 * 1024) // 100MB
.weigher((String key, BufferedImage image) -> image.getWidth() * image.getHeight() * 3)
.removalListener((key, value, cause) -> {
logger.info("移除缓存:{}",key);
if (value != null) {
value.flush();
}
})
.expireAfterAccess(10, TimeUnit.MINUTES) // 可设置失效时间
.build();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment