From 9c494b4e9718e79e5b7383a67ff821979bae163a Mon Sep 17 00:00:00 2001 From: fengyw Date: Mon, 27 Nov 2023 15:21:55 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E4=BC=98=E5=8C=96=E9=AA=8C=E8=AF=81?= =?UTF-8?q?=E7=A0=81=E5=8F=91=E9=80=81=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/roncoo/education/common/cache/CacheRedis.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/roncoo-education-common/roncoo-education-common-service/src/main/java/com/roncoo/education/common/cache/CacheRedis.java b/roncoo-education-common/roncoo-education-common-service/src/main/java/com/roncoo/education/common/cache/CacheRedis.java index b52d7b3c..1d24834c 100644 --- a/roncoo-education-common/roncoo-education-common-service/src/main/java/com/roncoo/education/common/cache/CacheRedis.java +++ b/roncoo-education-common/roncoo-education-common-service/src/main/java/com/roncoo/education/common/cache/CacheRedis.java @@ -29,7 +29,7 @@ public class CacheRedis { public T set(String key, T t) { if (t != null) { String value = t.toString(); - if (!(t instanceof String)) { + if (!(t instanceof String || t instanceof Long || t instanceof Integer)) { value = JSUtil.toJsonString(t); } stringRedisTemplate.opsForValue().set(key, value, timeToLive, TimeUnit.MILLISECONDS); @@ -43,7 +43,7 @@ public class CacheRedis { public T set(String key, T t, int time, TimeUnit timeUnit) { if (t != null) { String value = t.toString(); - if (!(t instanceof String)) { + if (!(t instanceof String || t instanceof Long || t instanceof Integer)) { value = JSUtil.toJsonString(t); } stringRedisTemplate.opsForValue().set(key, value, time, timeUnit); -- GitLab