@Configuration @EnableCaching @ComponentScan(value="wang.bigbird.domain.framework.cache") @Conditional(value=CacheEnableCondition.class) public class CacheConfiguration extends Object
构造器和说明 |
---|
CacheConfiguration() |
限定符和类型 | 方法和说明 |
---|---|
CustomizedCaffeineCacheManager |
caffeineCacheManager(CacheProperties cacheProperties)
使用 Caffeine 作为缓存中间件
|
void |
init() |
CustomizedRedissonSpringCacheManager |
redissonCacheManager(org.redisson.api.RedissonClient redissonClient,
CacheProperties cacheProperties)
如果需要使用 redis 作为缓存中间件
需要引入 bigbird-framework-data-redis,或者自己注册 redissonClient
|
@PostConstruct public void init()
@Bean @ConditionalOnProperty(prefix="spring.cache", name="type", havingValue="redis") public CustomizedRedissonSpringCacheManager redissonCacheManager(org.redisson.api.RedissonClient redissonClient, CacheProperties cacheProperties)
@Bean @ConditionalOnProperty(prefix="spring.cache", name="type", havingValue="caffeine") public CustomizedCaffeineCacheManager caffeineCacheManager(CacheProperties cacheProperties)