我正在創建一個通過 redisson 客戶端使用 Redis 快取的 Spring 應用程式。
@Bean
public CacheManager cacheManager(RedissonClient redissonClient) throws IOException {
Map<String, CacheConfig> config = new HashMap<String,CacheConfig>();
config.put("employeesCache", new CacheConfig(24*60*1000, 12*60*1000));
RedissonSpringCacheManager manager= new RedissonSpringCacheManager(redissonClient, config);
return manager;
}
但是,在運行此應用程式時,在 Redis 中創建的快取名稱{employeesCache}:redisson_options不僅僅是employeesCache.
此外,當我在 Redis CLI 中檢查 TTL 時,它會回傳(integer) -1,這意味著它尚未設定。
所以 RedissonSpringCacheManager 部分功能,它創建快取但沒有任何配置,你能幫我修復它嗎?
我正在使用以下 Maven 依賴項
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-redis</artifactId>
</dependency>
<dependency>
<groupId>org.redisson</groupId>
<artifactId>redisson-spring-boot-starter</artifactId>
<version>3.13.1</version>
</dependency>
uj5u.com熱心網友回復:
Redisson 使用 map 保存資料,但是 map 中的鍵不支持 TTL,所以Redisson維護 a{employeesCache}:redisson_options來保存配置,您的 employeesCache 鍵由 維護和洗掉redisson,NOT redis
因此,您的資料將保存在名為 的地圖employeesCache中,而不是保存在 中{employeesCache}:redisson_options,不要管它。
轉載請註明出處,本文鏈接:https://www.uj5u.com/gongcheng/514510.html
標籤:春天行家缓存雷迪斯雷迪森
上一篇:找不到semver4j-0.16.4-nodeps.jar(com.github.gundy:semver4j:0.16.4)。-安卓作業室Java
