use of org.springframework.data.redis.cache.RedisCacheManager in project springBoot-learn-demo by nbfujx.
the class RedisConfig method cacheManager.
@Bean
public CacheManager cacheManager(RedisTemplate<Object, Object> redisTemplate) {
RedisCacheManager cacheManager = new RedisCacheManager(redisTemplate);
cacheManager.setDefaultExpiration(1800);
return cacheManager;
}
use of org.springframework.data.redis.cache.RedisCacheManager in project new-cloud by xie-summer.
the class RedisCacheConfig method cacheManager.
@Bean
public CacheManager cacheManager(RedisTemplate redisTemplate) {
RedisCacheManager rcm = new RedisCacheManager(redisTemplate);
rcm.setDefaultExpiration(expiration);
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;
}
use of org.springframework.data.redis.cache.RedisCacheManager in project loc-framework by lord-of-code.
the class RedisCacheAutoConfiguration method getRedisCacheManager.
@Bean
public RedisCacheManager getRedisCacheManager(RedisConnectionFactory redisConnectionFactory) {
CustomRedisCacheWriter customRedisCacheWriter = new CustomRedisCacheWriter(RedisCacheWriter.lockingRedisCacheWriter(redisConnectionFactory));
RedisCacheManager.RedisCacheManagerBuilder builder = RedisCacheManager.RedisCacheManagerBuilder.fromCacheWriter(customRedisCacheWriter).cacheDefaults(determineConfiguration());
List<String> cacheNames = this.cacheProperties.getCacheNames();
if (!cacheNames.isEmpty()) {
try {
LocCustomCacheProperties customCacheProperties = resolverSetting(LocCustomCacheProperties.class, this.environment.getPropertySources());
Map<String, RedisCacheConfiguration> map = Maps.newHashMap();
cacheNames.forEach(name -> {
LocCacheProperties locCacheProperties = customCacheProperties.getCustomCache().get(name);
RedisCacheConfiguration redisCacheConfiguration = determineConfiguration();
if (locCacheProperties.getTimeToLive() != null) {
redisCacheConfiguration = redisCacheConfiguration.entryTtl(locCacheProperties.getTimeToLive());
}
if (locCacheProperties.getKeyPrefix() != null) {
redisCacheConfiguration = redisCacheConfiguration.prefixKeysWith(locCacheProperties.getKeyPrefix());
}
if (!locCacheProperties.isCacheNullValues()) {
redisCacheConfiguration = redisCacheConfiguration.disableCachingNullValues();
}
if (!locCacheProperties.isUseKeyPrefix()) {
redisCacheConfiguration = redisCacheConfiguration.disableKeyPrefix();
}
map.put(name, redisCacheConfiguration);
});
builder.withInitialCacheConfigurations(map);
} catch (FatalBeanException e) {
log.warn("may be not config customCache properties");
}
}
return builder.build();
}
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;
}
Aggregations