1、缓存问题修改

This commit is contained in:
zhengyf 2025-08-23 14:20:02 +08:00
parent d20d493522
commit d1954cb64b
1 changed files with 17 additions and 10 deletions

View File

@ -5,28 +5,35 @@ import org.springframework.cache.CacheManager;
import org.springframework.cache.annotation.CachingConfigurerSupport;
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.cache.concurrent.ConcurrentMapCache;
import org.springframework.cache.concurrent.ConcurrentMapCacheManager;
import org.springframework.cache.support.SimpleCacheManager;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
@Configuration
@EnableCaching
public class CacheConfig extends CachingConfigurerSupport {
@Override
@Bean
public CacheManager cacheManager() {
SimpleCacheManager cacheManager = new SimpleCacheManager();
// 添加所有需要的缓存包括缺失的mdmModuleDb
List<Cache> caches = new ArrayList<>();
caches.add(new ConcurrentMapCache("mdmModuleDb"));
caches.add(new ConcurrentMapCache("mdmModuleDbFileds"));
caches.add(new ConcurrentMapCache("mdmModule"));
cacheManager.setCaches(caches);
public ConcurrentMapCacheManager cacheManager() {
// 整合所有需要的缓存名称原有的mdm相关缓存 + 新的业务缓存
List<String> cacheNames = Arrays.asList(
// 原有缓存来自SimpleCacheManager的配置
"mdmModuleDb",
"mdmModuleDbFileds",
"mdmModule",
// 新添加的业务缓存来自之前的ConcurrentMapCacheManager配置
"sysApplicationPlugin",
"IntegrationTask",
"IntegrationTaskLiving"
);
ConcurrentMapCacheManager cacheManager = new ConcurrentMapCacheManager();
cacheManager.setCacheNames(cacheNames); // 注册所有缓存名称
return cacheManager;
}
}