Commit e1fe21f24c4769e7cc47a6e750787b7ce7f24040
1 parent
47698bfc
Revert "feat: 将 redisCache 的扫描策略设置成 scan"
This reverts commit 72d2dcc68f46e14a868838434b5bcf681beb55bc.
Showing
4 changed files
with
5 additions
and
35 deletions
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,7 +4,6 @@ import cn.hutool.core.annotation.AnnotationUtil; | ||
| 4 | import cn.iocoder.yudao.framework.common.enums.WebFilterOrderEnum; | 4 | import cn.iocoder.yudao.framework.common.enums.WebFilterOrderEnum; |
| 5 | import cn.iocoder.yudao.framework.mybatis.core.util.MyBatisUtils; | 5 | import cn.iocoder.yudao.framework.mybatis.core.util.MyBatisUtils; |
| 6 | import cn.iocoder.yudao.framework.quartz.core.handler.JobHandler; | 6 | import cn.iocoder.yudao.framework.quartz.core.handler.JobHandler; |
| 7 | -import cn.iocoder.yudao.framework.redis.config.YudaoCacheProperties; | ||
| 8 | import cn.iocoder.yudao.framework.tenant.core.aop.TenantIgnoreAspect; | 7 | import cn.iocoder.yudao.framework.tenant.core.aop.TenantIgnoreAspect; |
| 9 | import cn.iocoder.yudao.framework.tenant.core.db.TenantDatabaseInterceptor; | 8 | import cn.iocoder.yudao.framework.tenant.core.db.TenantDatabaseInterceptor; |
| 10 | import cn.iocoder.yudao.framework.tenant.core.job.TenantJob; | 9 | import cn.iocoder.yudao.framework.tenant.core.job.TenantJob; |
| @@ -28,7 +27,6 @@ import org.springframework.boot.context.properties.EnableConfigurationProperties | @@ -28,7 +27,6 @@ import org.springframework.boot.context.properties.EnableConfigurationProperties | ||
| 28 | import org.springframework.boot.web.servlet.FilterRegistrationBean; | 27 | import org.springframework.boot.web.servlet.FilterRegistrationBean; |
| 29 | import org.springframework.context.annotation.Bean; | 28 | import org.springframework.context.annotation.Bean; |
| 30 | import org.springframework.context.annotation.Primary; | 29 | import org.springframework.context.annotation.Primary; |
| 31 | -import org.springframework.data.redis.cache.BatchStrategies; | ||
| 32 | import org.springframework.data.redis.cache.RedisCacheConfiguration; | 30 | import org.springframework.data.redis.cache.RedisCacheConfiguration; |
| 33 | import org.springframework.data.redis.cache.RedisCacheManager; | 31 | import org.springframework.data.redis.cache.RedisCacheManager; |
| 34 | import org.springframework.data.redis.cache.RedisCacheWriter; | 32 | import org.springframework.data.redis.cache.RedisCacheWriter; |
| @@ -126,12 +124,10 @@ public class YudaoTenantAutoConfiguration { | @@ -126,12 +124,10 @@ public class YudaoTenantAutoConfiguration { | ||
| 126 | @Bean | 124 | @Bean |
| 127 | @Primary // 引入租户时,tenantRedisCacheManager 为主 Bean | 125 | @Primary // 引入租户时,tenantRedisCacheManager 为主 Bean |
| 128 | public RedisCacheManager tenantRedisCacheManager(RedisTemplate<String, Object> redisTemplate, | 126 | public RedisCacheManager tenantRedisCacheManager(RedisTemplate<String, Object> redisTemplate, |
| 129 | - RedisCacheConfiguration redisCacheConfiguration, | ||
| 130 | - YudaoCacheProperties yudaoCacheProperties) { | 127 | + RedisCacheConfiguration redisCacheConfiguration) { |
| 131 | // 创建 RedisCacheWriter 对象 | 128 | // 创建 RedisCacheWriter 对象 |
| 132 | RedisConnectionFactory connectionFactory = Objects.requireNonNull(redisTemplate.getConnectionFactory()); | 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 | // 创建 TenantRedisCacheManager 对象 | 131 | // 创建 TenantRedisCacheManager 对象 |
| 136 | return new TenantRedisCacheManager(cacheWriter, redisCacheConfiguration); | 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,7 +8,6 @@ import org.springframework.boot.context.properties.EnableConfigurationProperties | ||
| 8 | import org.springframework.cache.annotation.EnableCaching; | 8 | import org.springframework.cache.annotation.EnableCaching; |
| 9 | import org.springframework.context.annotation.Bean; | 9 | import org.springframework.context.annotation.Bean; |
| 10 | import org.springframework.context.annotation.Primary; | 10 | import org.springframework.context.annotation.Primary; |
| 11 | -import org.springframework.data.redis.cache.BatchStrategies; | ||
| 12 | import org.springframework.data.redis.cache.RedisCacheConfiguration; | 11 | import org.springframework.data.redis.cache.RedisCacheConfiguration; |
| 13 | import org.springframework.data.redis.cache.RedisCacheManager; | 12 | import org.springframework.data.redis.cache.RedisCacheManager; |
| 14 | import org.springframework.data.redis.cache.RedisCacheWriter; | 13 | import org.springframework.data.redis.cache.RedisCacheWriter; |
| @@ -24,7 +23,7 @@ import static cn.iocoder.yudao.framework.redis.config.YudaoRedisAutoConfiguratio | @@ -24,7 +23,7 @@ import static cn.iocoder.yudao.framework.redis.config.YudaoRedisAutoConfiguratio | ||
| 24 | * Cache 配置类,基于 Redis 实现 | 23 | * Cache 配置类,基于 Redis 实现 |
| 25 | */ | 24 | */ |
| 26 | @AutoConfiguration | 25 | @AutoConfiguration |
| 27 | -@EnableConfigurationProperties({CacheProperties.class, YudaoCacheProperties.class}) | 26 | +@EnableConfigurationProperties({CacheProperties.class}) |
| 28 | @EnableCaching | 27 | @EnableCaching |
| 29 | public class YudaoCacheAutoConfiguration { | 28 | public class YudaoCacheAutoConfiguration { |
| 30 | 29 | ||
| @@ -63,12 +62,10 @@ public class YudaoCacheAutoConfiguration { | @@ -63,12 +62,10 @@ public class YudaoCacheAutoConfiguration { | ||
| 63 | 62 | ||
| 64 | @Bean | 63 | @Bean |
| 65 | public RedisCacheManager redisCacheManager(RedisTemplate<String, Object> redisTemplate, | 64 | public RedisCacheManager redisCacheManager(RedisTemplate<String, Object> redisTemplate, |
| 66 | - RedisCacheConfiguration redisCacheConfiguration, | ||
| 67 | - YudaoCacheProperties yudaoCacheProperties) { | 65 | + RedisCacheConfiguration redisCacheConfiguration) { |
| 68 | // 创建 RedisCacheWriter 对象 | 66 | // 创建 RedisCacheWriter 对象 |
| 69 | RedisConnectionFactory connectionFactory = Objects.requireNonNull(redisTemplate.getConnectionFactory()); | 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 | // 创建 TenantRedisCacheManager 对象 | 69 | // 创建 TenantRedisCacheManager 对象 |
| 73 | return new TimeoutRedisCacheManager(cacheWriter, redisCacheConfiguration); | 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,8 +204,6 @@ yudao: | ||
| 204 | order: | 204 | order: |
| 205 | app-id: 1 # 商户编号 | 205 | app-id: 1 # 商户编号 |
| 206 | expire-time: 2h # 支付的过期时间 | 206 | expire-time: 2h # 支付的过期时间 |
| 207 | - cache: # spring cache 相关配置 | ||
| 208 | - redis-scan-batch-size: 30 # redis scan 一次返回数量 | ||
| 209 | 207 | ||
| 210 | debug: false | 208 | debug: false |
| 211 | 209 |