feat: 增加 spring cache 开关配置,默认关闭
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package com.youlai.system.config;
|
||||
|
||||
import org.springframework.boot.autoconfigure.cache.CacheProperties;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
||||
import org.springframework.cache.annotation.EnableCaching;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
@@ -21,6 +22,7 @@ import org.springframework.data.redis.serializer.RedisSerializer;
|
||||
@EnableCaching
|
||||
@EnableConfigurationProperties(CacheProperties.class)
|
||||
@Configuration
|
||||
@ConditionalOnProperty(name = "spring.cache.enabled") // xxl.job.enabled = true 才会自动装配
|
||||
public class RedisCacheConfig {
|
||||
|
||||
/**
|
||||
|
||||
@@ -31,6 +31,7 @@ spring:
|
||||
# 连接池中的最小空闲连接 默认0
|
||||
min-idle: 0
|
||||
cache:
|
||||
enabled: false
|
||||
# 缓存类型 redis、none(不使用缓存)
|
||||
type: redis
|
||||
# 缓存时间(单位:ms)
|
||||
|
||||
@@ -31,6 +31,7 @@ spring:
|
||||
# 连接池中的最小空闲连接 默认0
|
||||
min-idle: 0
|
||||
cache:
|
||||
enabled: false
|
||||
# 缓存类型 redis、none(不使用缓存)
|
||||
type: redis
|
||||
# 缓存时间(单位:ms)
|
||||
|
||||
Reference in New Issue
Block a user