🐛 修复切换存储引擎时, 没有清空原引擎缓存的 BUG.

This commit is contained in:
zhaojun1998
2020-01-24 10:46:00 +08:00
parent 3719378614
commit f32e5e8f9e
2 changed files with 3 additions and 3 deletions

View File

@@ -54,11 +54,12 @@ public class AdminController {
*/
@PostMapping("/config")
public ResultBean updateConfig(SystemConfigDTO systemConfigDTO) throws Exception {
StorageTypeEnum currentStorageStrategy = systemConfigService.getCurrentStorageStrategy();
AbstractFileService currentFileService = systemConfigService.getCurrentFileService();
currentFileService.clearFileCache();
systemConfigDTO.setId(1);
systemConfigService.updateSystemConfig(systemConfigDTO);
StorageTypeEnum currentStorageStrategy = currentFileService.getStorageTypeEnum();
if (!Objects.equals(currentStorageStrategy, systemConfigDTO.getStorageStrategy())) {
log.info("已将存储策略由 {} 切换为 {}", currentStorageStrategy, systemConfigDTO.getStorageStrategy());
refreshStorageStrategy();