|
|
@@ -2,6 +2,8 @@ package com.usoftchina.saas.cache;
|
|
|
|
|
|
import org.springframework.data.redis.core.BoundHashOperations;
|
|
|
import org.springframework.data.redis.core.RedisTemplate;
|
|
|
+import org.springframework.data.redis.serializer.Jackson2JsonRedisSerializer;
|
|
|
+import org.springframework.data.redis.serializer.StringRedisSerializer;
|
|
|
|
|
|
import java.util.Optional;
|
|
|
import java.util.Set;
|
|
|
@@ -25,6 +27,9 @@ public abstract class RedisHashCache<K, F, V> extends BaseRedisCache<K, V> {
|
|
|
protected abstract F field();
|
|
|
|
|
|
protected BoundHashOperations<K, F, V> getBoundHashOperations() {
|
|
|
+ RedisTemplate redisTemplate = super.getRedisTemplate();
|
|
|
+ redisTemplate.setHashKeySerializer(new StringRedisSerializer());
|
|
|
+ redisTemplate.setHashValueSerializer(new Jackson2JsonRedisSerializer(Object.class));
|
|
|
return super.getRedisTemplate().boundHashOps(key());
|
|
|
}
|
|
|
|