use of org.springframework.data.redis.cache.RedisCacheManager in project spring-boot by spring-projects.
the class RedisCacheConfiguration method cacheManager.
@Bean
public RedisCacheManager cacheManager(RedisTemplate<Object, Object> redisTemplate) {
RedisCacheManager cacheManager = new RedisCacheManager(redisTemplate);
cacheManager.setUsePrefix(true);
List<String> cacheNames = this.cacheProperties.getCacheNames();
if (!cacheNames.isEmpty()) {
cacheManager.setCacheNames(cacheNames);
}
return this.customizerInvoker.customize(cacheManager);
}
use of org.springframework.data.redis.cache.RedisCacheManager in project spring-boot by spring-projects.
the class CacheAutoConfigurationTests method redisCacheWithRedisCacheManagerBuilderCustomizer.
@Test
void redisCacheWithRedisCacheManagerBuilderCustomizer() {
this.contextRunner.withUserConfiguration(RedisWithRedisCacheManagerBuilderCustomizerConfiguration.class).withPropertyValues("spring.cache.type=redis", "spring.cache.redis.time-to-live=15000").run((context) -> {
RedisCacheManager cacheManager = getCacheManager(context, RedisCacheManager.class);
RedisCacheConfiguration redisCacheConfiguration = getDefaultRedisCacheConfiguration(cacheManager);
assertThat(redisCacheConfiguration.getTtl()).isEqualTo(java.time.Duration.ofSeconds(10));
});
}
use of org.springframework.data.redis.cache.RedisCacheManager in project cu-kfs by CU-CommunityApps.
the class CacheConfiguration method cacheManager.
@Bean
public RedisCacheManager cacheManager(@Value("${redis.default.ttl}") Long redisDefaultTtl, RedisTemplate<String, String> redisTemplate, List<String> cacheNames, Map<String, Long> cacheExpires) {
// Cornell customization: add fix to call cacheNames() method instead of using the cacheNames variable that is causing an exception
final RedisCacheManager redisCacheManager = new RedisCacheManager(redisTemplate, cacheNames(), true);
redisCacheManager.setDefaultExpiration(redisDefaultTtl);
redisCacheManager.setExpires(cacheExpires);
return redisCacheManager;
}
use of org.springframework.data.redis.cache.RedisCacheManager in project CBEC-B2B by A-Cubic.
the class RedisConfig method cacheManager.
@SuppressWarnings("rawtypes")
@Bean
public CacheManager cacheManager(RedisTemplate redisTemplate) {
RedisCacheManager rcm = new RedisCacheManager(redisTemplate);
// 设置缓存过期时间
// 秒
rcm.setDefaultExpiration(7200);
return rcm;
}
use of org.springframework.data.redis.cache.RedisCacheManager in project fw-cloud-framework by liuweijw.
the class RedisCacheConfiguration method cacheManager.
@SuppressWarnings("rawtypes")
@Bean
public CacheManager cacheManager(RedisTemplate redisTemplate) {
RedisCacheManager redisCacheManager = new RedisCacheManager(redisTemplate);
redisCacheManager.setDefaultExpiration(expiration);
return redisCacheManager;
}
Aggregations