@Configuration
@EnableCaching
public class RedisConfig
extends org.springframework.cache.annotation.CachingConfigurerSupport
该类为 redis 核心配置, 对 spring-boot-starter-cache 组件进行了集成, 同时优化了 RedisTemplate 的序列化与反序列化规则
RedisAutoConfiguration| 构造器和说明 |
|---|
RedisConfig() |
| 限定符和类型 | 方法和说明 |
|---|---|
org.springframework.cache.CacheManager |
cacheManager() |
org.springframework.cache.interceptor.KeyGenerator |
keyGenerator() |
RedisService |
redisService() |
<V> org.springframework.data.redis.core.RedisTemplate<String,V> |
redisTemplate() |
public org.springframework.cache.interceptor.KeyGenerator keyGenerator()
keyGenerator 在接口中 org.springframework.cache.annotation.CachingConfigurerkeyGenerator 在类中 org.springframework.cache.annotation.CachingConfigurerSupportpublic org.springframework.cache.CacheManager cacheManager()
cacheManager 在接口中 org.springframework.cache.annotation.CachingConfigurercacheManager 在类中 org.springframework.cache.annotation.CachingConfigurerSupport@Bean public <V> org.springframework.data.redis.core.RedisTemplate<String,V> redisTemplate()
@Bean @ConditionalOnMissingBean(value=RedisService.class) public RedisService redisService()
Copyright © 2021 HaiChuang Inc.. All rights reserved.