优化缓存策略, 开启/关闭缓存后同步控制自动刷新策略

This commit is contained in:
zhaojun1998
2020-01-05 15:56:17 +08:00
parent f128882034
commit cc993d8e65
2 changed files with 16 additions and 2 deletions

View File

@@ -136,14 +136,17 @@ public class SystemConfigService {
systemConfigRepository.saveAll(systemConfigList);
AbstractFileService currentFileService = getCurrentFileService();
if (!oldEnableCache && curEnableCache) {
log.debug("检测到开启了缓存, 开启预热缓存");
currentFileService.openCacheAutoRefresh();
fileAsyncCacheService.cacheGlobalFile();
}
if (oldEnableCache && !curEnableCache) {
log.debug("检测到关闭了缓存, 正在清理缓存数据");
getCurrentFileService().clearCache();
log.debug("检测到关闭了缓存, 正在清理缓存数据及关闭自动刷新");
currentFileService.clearCache();
}
}