1. 统一包名修改
This commit is contained in:
@@ -19,15 +19,15 @@ import org.springframework.util.StringUtils;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
import static com.zt.plat.framework.redis.config.CloudRedisAutoConfiguration.buildRedisSerializer;
|
||||
import static com.zt.plat.framework.redis.config.ZtRedisAutoConfiguration.buildRedisSerializer;
|
||||
|
||||
/**
|
||||
* Cache 配置类,基于 Redis 实现
|
||||
*/
|
||||
@AutoConfiguration
|
||||
@EnableConfigurationProperties({CacheProperties.class, CloudCacheProperties.class})
|
||||
@EnableConfigurationProperties({CacheProperties.class, ZtCacheProperties.class})
|
||||
@EnableCaching
|
||||
public class CloudCacheAutoConfiguration {
|
||||
public class ZtCacheAutoConfiguration {
|
||||
|
||||
/**
|
||||
* RedisCacheConfiguration Bean
|
||||
@@ -40,7 +40,7 @@ public class CloudCacheAutoConfiguration {
|
||||
RedisCacheConfiguration config = RedisCacheConfiguration.defaultCacheConfig();
|
||||
// 设置使用 : 单冒号,而不是双 :: 冒号,避免 Redis Desktop Manager 多余空格
|
||||
// 详细可见 https://blog.csdn.net/chuixue24/article/details/103928965 博客
|
||||
// 再次修复单冒号,而不是双 :: 冒号问题,Issues 详情:https://gitee.com/zhijiantianya/cloud-cloud/issues/I86VY2
|
||||
// 再次修复单冒号,而不是双 :: 冒号问题,Issues 详情:https://gitee.com/zhijiantianya/zt-cloud/issues/I86VY2
|
||||
config = config.computePrefixWith(cacheName -> {
|
||||
String keyPrefix = cacheProperties.getRedis().getKeyPrefix();
|
||||
if (StringUtils.hasText(keyPrefix)) {
|
||||
@@ -70,11 +70,11 @@ public class CloudCacheAutoConfiguration {
|
||||
@Bean
|
||||
public RedisCacheManager redisCacheManager(RedisTemplate<String, Object> redisTemplate,
|
||||
RedisCacheConfiguration redisCacheConfiguration,
|
||||
CloudCacheProperties cloudCacheProperties) {
|
||||
ZtCacheProperties ztCacheProperties) {
|
||||
// 创建 RedisCacheWriter 对象
|
||||
RedisConnectionFactory connectionFactory = Objects.requireNonNull(redisTemplate.getConnectionFactory());
|
||||
RedisCacheWriter cacheWriter = RedisCacheWriter.nonLockingRedisCacheWriter(connectionFactory,
|
||||
BatchStrategies.scan(cloudCacheProperties.getRedisScanBatchSize()));
|
||||
BatchStrategies.scan(ztCacheProperties.getRedisScanBatchSize()));
|
||||
// 创建 TenantRedisCacheManager 对象
|
||||
return new TimeoutRedisCacheManager(cacheWriter, redisCacheConfiguration);
|
||||
}
|
||||
@@ -9,10 +9,10 @@ import org.springframework.validation.annotation.Validated;
|
||||
*
|
||||
* @author Wanwan
|
||||
*/
|
||||
@ConfigurationProperties("cloud.cache")
|
||||
@ConfigurationProperties("zt.cache")
|
||||
@Data
|
||||
@Validated
|
||||
public class CloudCacheProperties {
|
||||
public class ZtCacheProperties {
|
||||
|
||||
/**
|
||||
* {@link #redisScanBatchSize} 默认值
|
||||
@@ -14,7 +14,7 @@ import org.springframework.data.redis.serializer.RedisSerializer;
|
||||
* Redis 配置类
|
||||
*/
|
||||
@AutoConfiguration(before = RedissonAutoConfigurationV2.class) // 目的:使用自己定义的 RedisTemplate Bean
|
||||
public class CloudRedisAutoConfiguration {
|
||||
public class ZtRedisAutoConfiguration {
|
||||
|
||||
/**
|
||||
* 创建 RedisTemplate Bean,使用 JSON 序列化方式
|
||||
@@ -1,2 +1,2 @@
|
||||
com.zt.plat.framework.redis.config.CloudRedisAutoConfiguration
|
||||
com.zt.plat.framework.redis.config.CloudCacheAutoConfiguration
|
||||
com.zt.plat.framework.redis.config.ZtRedisAutoConfiguration
|
||||
com.zt.plat.framework.redis.config.ZtCacheAutoConfiguration
|
||||
|
||||
Reference in New Issue
Block a user