|
@@ -3,6 +3,7 @@ package com.yoho.search.cache.beans; |
|
@@ -3,6 +3,7 @@ package com.yoho.search.cache.beans; |
3
|
import com.alibaba.fastjson.JSON;
|
3
|
import com.alibaba.fastjson.JSON;
|
4
|
import com.alibaba.fastjson.JSONArray;
|
4
|
import com.alibaba.fastjson.JSONArray;
|
5
|
import com.alibaba.fastjson.JSONObject;
|
5
|
import com.alibaba.fastjson.JSONObject;
|
|
|
6
|
+import com.alibaba.fastjson.serializer.SerializerFeature;
|
6
|
import com.yoho.core.redis.cluster.operations.serializer.RedisKeyBuilder;
|
7
|
import com.yoho.core.redis.cluster.operations.serializer.RedisKeyBuilder;
|
7
|
import com.yoho.search.base.utils.MD5Util;
|
8
|
import com.yoho.search.base.utils.MD5Util;
|
8
|
import com.yoho.search.cache.model.CacheObject;
|
9
|
import com.yoho.search.cache.model.CacheObject;
|
|
@@ -125,7 +126,7 @@ public class SearchCacheService { |
|
@@ -125,7 +126,7 @@ public class SearchCacheService { |
125
|
|
126
|
|
126
|
public <T> void addSerializableObjectToCache(SearchCache searchCache, RedisKeyBuilder redisKeyBuilder, T object, boolean useJsonSerializable) {
|
127
|
public <T> void addSerializableObjectToCache(SearchCache searchCache, RedisKeyBuilder redisKeyBuilder, T object, boolean useJsonSerializable) {
|
127
|
if (useJsonSerializable) {
|
128
|
if (useJsonSerializable) {
|
128
|
- String jsonStr = JSON.toJSONString(object);
|
129
|
+ String jsonStr = JSON.toJSONString(object,SerializerFeature.WriteMapNullValue,SerializerFeature.DisableCircularReferenceDetect);
|
129
|
this.addObjectToCache(redisKeyBuilder, jsonStr, searchCache);
|
130
|
this.addObjectToCache(redisKeyBuilder, jsonStr, searchCache);
|
130
|
} else {
|
131
|
} else {
|
131
|
this.addObjectToCache(redisKeyBuilder, object, searchCache);
|
132
|
this.addObjectToCache(redisKeyBuilder, object, searchCache);
|