👎 处理product的list json
This commit is contained in:
+23
-23
@@ -21,28 +21,28 @@ public class YudaoCacheAutoConfiguration {
|
||||
*
|
||||
* 参考 org.springframework.boot.autoconfigure.cache.RedisCacheConfiguration 的 createConfiguration 方法
|
||||
*/
|
||||
@Bean
|
||||
@Primary
|
||||
public RedisCacheConfiguration redisCacheConfiguration(CacheProperties cacheProperties) {
|
||||
// 设置使用 JSON 序列化方式
|
||||
RedisCacheConfiguration config = RedisCacheConfiguration.defaultCacheConfig();
|
||||
config = config.serializeValuesWith(RedisSerializationContext.SerializationPair.fromSerializer(RedisSerializer.json()));
|
||||
|
||||
// 设置 CacheProperties.Redis 的属性
|
||||
CacheProperties.Redis redisProperties = cacheProperties.getRedis();
|
||||
if (redisProperties.getTimeToLive() != null) {
|
||||
config = config.entryTtl(redisProperties.getTimeToLive());
|
||||
}
|
||||
if (redisProperties.getKeyPrefix() != null) {
|
||||
config = config.prefixCacheNameWith(redisProperties.getKeyPrefix());
|
||||
}
|
||||
if (!redisProperties.isCacheNullValues()) {
|
||||
config = config.disableCachingNullValues();
|
||||
}
|
||||
if (!redisProperties.isUseKeyPrefix()) {
|
||||
config = config.disableKeyPrefix();
|
||||
}
|
||||
return config;
|
||||
}
|
||||
// @Bean
|
||||
// @Primary
|
||||
// public RedisCacheConfiguration redisCacheConfiguration(CacheProperties cacheProperties) {
|
||||
// // 设置使用 JSON 序列化方式
|
||||
// RedisCacheConfiguration config = RedisCacheConfiguration.defaultCacheConfig();
|
||||
// config = config.serializeValuesWith(RedisSerializationContext.SerializationPair.fromSerializer(RedisSerializer.json()));
|
||||
//
|
||||
// // 设置 CacheProperties.Redis 的属性
|
||||
// CacheProperties.Redis redisProperties = cacheProperties.getRedis();
|
||||
// if (redisProperties.getTimeToLive() != null) {
|
||||
// config = config.entryTtl(redisProperties.getTimeToLive());
|
||||
// }
|
||||
// if (redisProperties.getKeyPrefix() != null) {
|
||||
// config = config.prefixCacheNameWith(redisProperties.getKeyPrefix());
|
||||
// }
|
||||
// if (!redisProperties.isCacheNullValues()) {
|
||||
// config = config.disableCachingNullValues();
|
||||
// }
|
||||
// if (!redisProperties.isUseKeyPrefix()) {
|
||||
// config = config.disableKeyPrefix();
|
||||
// }
|
||||
// return config;
|
||||
// }
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user