Commit 30cf278b by 王祖波

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

配置是否使用缓存

See merge request !2362
parents aa46a112 9ed12401
......@@ -171,9 +171,14 @@ public class ImageCombined {
* 从缓存中加载图像
*/
private static BufferedImage loadImageWithCache(String url) {
boolean useCache = ApolloUtils.combinedCache();
if (!useCache) {
logger.info("非缓存加载图片:{}", url);
return loadImageWithReader(url);
}
return imageCache.get(url, key -> {
try {
logger.info("加载图片buffered:{},key:{}", url, key);
logger.info("加载图片buffered:{}", url);
return loadImageWithReader(key); // 使用读取器方法
} catch (Exception e) {
logger.error("获取图片异常", e);
......
......@@ -64,6 +64,15 @@ public class ApolloUtils {
return Integer.parseInt(combinedFontsType);
}
public static boolean combinedCache() {
Config config = ConfigService.getAppConfig();
String combinedCache = config.getProperty("combinedCache", "");
if (StringUtils.isBlank(combinedCache)) {
return false;
}
return true;
}
/**
* 线程池核心线程数
* @return
......
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