Commit e1fe21f24c4769e7cc47a6e750787b7ce7f24040

Authored by wanwan
1 parent 47698bfc

Revert "feat: 将 redisCache 的扫描策略设置成 scan"

This reverts commit 72d2dcc68f46e14a868838434b5bcf681beb55bc.
yudao-framework/yudao-spring-boot-starter-biz-tenant/src/main/java/cn/iocoder/yudao/framework/tenant/config/YudaoTenantAutoConfiguration.java
... ... @@ -4,7 +4,6 @@ import cn.hutool.core.annotation.AnnotationUtil;
4 4 import cn.iocoder.yudao.framework.common.enums.WebFilterOrderEnum;
5 5 import cn.iocoder.yudao.framework.mybatis.core.util.MyBatisUtils;
6 6 import cn.iocoder.yudao.framework.quartz.core.handler.JobHandler;
7   -import cn.iocoder.yudao.framework.redis.config.YudaoCacheProperties;
8 7 import cn.iocoder.yudao.framework.tenant.core.aop.TenantIgnoreAspect;
9 8 import cn.iocoder.yudao.framework.tenant.core.db.TenantDatabaseInterceptor;
10 9 import cn.iocoder.yudao.framework.tenant.core.job.TenantJob;
... ... @@ -28,7 +27,6 @@ import org.springframework.boot.context.properties.EnableConfigurationProperties
28 27 import org.springframework.boot.web.servlet.FilterRegistrationBean;
29 28 import org.springframework.context.annotation.Bean;
30 29 import org.springframework.context.annotation.Primary;
31   -import org.springframework.data.redis.cache.BatchStrategies;
32 30 import org.springframework.data.redis.cache.RedisCacheConfiguration;
33 31 import org.springframework.data.redis.cache.RedisCacheManager;
34 32 import org.springframework.data.redis.cache.RedisCacheWriter;
... ... @@ -126,12 +124,10 @@ public class YudaoTenantAutoConfiguration {
126 124 @Bean
127 125 @Primary // 引入租户时,tenantRedisCacheManager 为主 Bean
128 126 public RedisCacheManager tenantRedisCacheManager(RedisTemplate<String, Object> redisTemplate,
129   - RedisCacheConfiguration redisCacheConfiguration,
130   - YudaoCacheProperties yudaoCacheProperties) {
  127 + RedisCacheConfiguration redisCacheConfiguration) {
131 128 // 创建 RedisCacheWriter 对象
132 129 RedisConnectionFactory connectionFactory = Objects.requireNonNull(redisTemplate.getConnectionFactory());
133   - RedisCacheWriter cacheWriter = RedisCacheWriter.nonLockingRedisCacheWriter(connectionFactory,
134   - BatchStrategies.scan(yudaoCacheProperties.getRedisScanBatchSize()));
  130 + RedisCacheWriter cacheWriter = RedisCacheWriter.nonLockingRedisCacheWriter(connectionFactory);
135 131 // 创建 TenantRedisCacheManager 对象
136 132 return new TenantRedisCacheManager(cacheWriter, redisCacheConfiguration);
137 133 }
... ...
yudao-framework/yudao-spring-boot-starter-redis/src/main/java/cn/iocoder/yudao/framework/redis/config/YudaoCacheAutoConfiguration.java
... ... @@ -8,7 +8,6 @@ import org.springframework.boot.context.properties.EnableConfigurationProperties
8 8 import org.springframework.cache.annotation.EnableCaching;
9 9 import org.springframework.context.annotation.Bean;
10 10 import org.springframework.context.annotation.Primary;
11   -import org.springframework.data.redis.cache.BatchStrategies;
12 11 import org.springframework.data.redis.cache.RedisCacheConfiguration;
13 12 import org.springframework.data.redis.cache.RedisCacheManager;
14 13 import org.springframework.data.redis.cache.RedisCacheWriter;
... ... @@ -24,7 +23,7 @@ import static cn.iocoder.yudao.framework.redis.config.YudaoRedisAutoConfiguratio
24 23 * Cache 配置类,基于 Redis 实现
25 24 */
26 25 @AutoConfiguration
27   -@EnableConfigurationProperties({CacheProperties.class, YudaoCacheProperties.class})
  26 +@EnableConfigurationProperties({CacheProperties.class})
28 27 @EnableCaching
29 28 public class YudaoCacheAutoConfiguration {
30 29  
... ... @@ -63,12 +62,10 @@ public class YudaoCacheAutoConfiguration {
63 62  
64 63 @Bean
65 64 public RedisCacheManager redisCacheManager(RedisTemplate<String, Object> redisTemplate,
66   - RedisCacheConfiguration redisCacheConfiguration,
67   - YudaoCacheProperties yudaoCacheProperties) {
  65 + RedisCacheConfiguration redisCacheConfiguration) {
68 66 // 创建 RedisCacheWriter 对象
69 67 RedisConnectionFactory connectionFactory = Objects.requireNonNull(redisTemplate.getConnectionFactory());
70   - RedisCacheWriter cacheWriter = RedisCacheWriter.nonLockingRedisCacheWriter(connectionFactory,
71   - BatchStrategies.scan(yudaoCacheProperties.getRedisScanBatchSize()));
  68 + RedisCacheWriter cacheWriter = RedisCacheWriter.nonLockingRedisCacheWriter(connectionFactory);
72 69 // 创建 TenantRedisCacheManager 对象
73 70 return new TimeoutRedisCacheManager(cacheWriter, redisCacheConfiguration);
74 71 }
... ...
yudao-framework/yudao-spring-boot-starter-redis/src/main/java/cn/iocoder/yudao/framework/redis/config/YudaoCacheProperties.java deleted
1   -package cn.iocoder.yudao.framework.redis.config;
2   -
3   -import lombok.Data;
4   -import org.springframework.boot.context.properties.ConfigurationProperties;
5   -import org.springframework.validation.annotation.Validated;
6   -
7   -/**
8   - * Cache 配置项
9   - *
10   - * @author
11   - */
12   -@ConfigurationProperties("yudao.cache")
13   -@Data
14   -@Validated
15   -public class YudaoCacheProperties {
16   -
17   - /**
18   - * redis scan 一次返回数量
19   - */
20   - private Integer redisScanBatchSize = 30;
21   -}
yudao-server/src/main/resources/application.yaml
... ... @@ -204,8 +204,6 @@ yudao:
204 204 order:
205 205 app-id: 1 # 商户编号
206 206 expire-time: 2h # 支付的过期时间
207   - cache: # spring cache 相关配置
208   - redis-scan-batch-size: 30 # redis scan 一次返回数量
209 207  
210 208 debug: false
211 209  
... ...