Commit 488c77c3 by 王祖波

Merge branch 'feature-chat-activity' into 'master'

缓存图片大小

See merge request !2320
parents 37dc6945 4193a09c
......@@ -42,9 +42,9 @@ public class ImageCombined {
private static final Logger logger = LoggerFactory.getLogger(ImageCombined.class);
private static final Cache<String, BufferedImage> imageCache = Caffeine.newBuilder()
.maximumWeight(50 * 1024 * 1024) // 50MB
.weigher((String key, BufferedImage image) -> image.getWidth() * image.getHeight() / 4)
.expireAfterAccess(30, TimeUnit.MINUTES) // 可设置失效时间
.maximumWeight(100 * 1024 * 1024) // 100MB
.weigher((String key, BufferedImage image) -> image.getWidth() * image.getHeight() * 3)
.expireAfterAccess(10, TimeUnit.MINUTES) // 可设置失效时间
.build();
public static final ThreadPoolExecutor EXECUTOR = new ThreadPoolExecutor(
......
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