我已经为缓存设置了ttl和idleTime,当应用程序运行时可以删除缓存,但是当我重新启动应用程序时,EvictionScheduler可能无法用于缓存,当ttl接近时缓存无法清除。
@Bean
public CacheManager cacheManager(RedissonClient redissonClient) throws IOException {
Map<String, CacheConfig> config = new HashMap<String, CacheConfig>();
config.put(CacheNames.XinLianService_getAllAgentData, new CacheConfig(60 * 1000, 60 * 1000));
config.put(CacheNames.XinlianRoleService_getById, new CacheConfig(2 * 60 * 1000, 60 * 1000));
return new RedissonSpringCacheManager(redissonClient, config);
}