diff --git a/src/main/java/im/zhaojun/common/controller/AdminController.java b/src/main/java/im/zhaojun/common/controller/AdminController.java index d4dc5e7..03f65ea 100644 --- a/src/main/java/im/zhaojun/common/controller/AdminController.java +++ b/src/main/java/im/zhaojun/common/controller/AdminController.java @@ -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(); diff --git a/src/main/java/im/zhaojun/common/controller/CacheController.java b/src/main/java/im/zhaojun/common/controller/CacheController.java index 17c59ec..132e986 100644 --- a/src/main/java/im/zhaojun/common/controller/CacheController.java +++ b/src/main/java/im/zhaojun/common/controller/CacheController.java @@ -68,7 +68,6 @@ public class CacheController { public ResultBean clearCache(String key) throws Exception { AbstractFileService fileService = systemConfigService.getCurrentFileService(); fileService.clearFileCache(); - fileAsyncCacheService.resetCacheCount(); return ResultBean.success(); }