From e8f63b29949a127a61a10adcadf31d46ac801994 Mon Sep 17 00:00:00 2001 From: BecomeDream <569513407@qq.com> Date: Fri, 11 Dec 2020 18:16:57 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9Set=E5=8F=AF=E8=83=BD?= =?UTF-8?q?=E5=AF=BC=E8=87=B4=E5=B5=8C=E5=A5=97=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/ruoyi/common/core/redis/RedisCache.java | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/core/redis/RedisCache.java b/ruoyi-common/src/main/java/com/ruoyi/common/core/redis/RedisCache.java index 1f91350a..b31929b3 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/core/redis/RedisCache.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/core/redis/RedisCache.java @@ -136,10 +136,15 @@ public class RedisCache * @param dataSet 缓存的数据 * @return 缓存数据的对象 */ - public long setCacheSet(final String key, final Set dataSet) + public BoundSetOperations setCacheSet(final String key, final Set dataSet) { - Long count = redisTemplate.opsForSet().add(key, dataSet); - return count == null ? 0 : count; + BoundSetOperations setOperation = redisTemplate.boundSetOps(key); + Iterator it = dataSet.iterator(); + while (it.hasNext()) + { + setOperation.add(it.next()); + } + return setOperation; } /**