美文网首页
redis -- springboot

redis -- springboot

作者: baby_honour | 来源:发表于2019-08-21 10:40 被阅读0次

原文:https://www.cnblogs.com/superfj/p/9232482.html

选择redis作为默认缓存工具

boot1.x
    @Bean
    public CacheManager cacheManager(RedisTemplate redisTemplate) {
        RedisCacheManager rcm = new RedisCacheManager(redisTemplate);
        return rcm;
    }
boot2.x
@Bean
public CacheManager cacheManager(RedisConnectionFactory connectionFactory) {
      RedisCacheManager rcm = RedisCacheManager.create(connectionFactory);
      return rcm;
}

相关文章