Commit e8f63b29949a127a61a10adcadf31d46ac801994

Authored by BecomeDream
Committed by Gitee
1 parent ecfe7006

修改Set可能导致嵌套的问题

ruoyi-common/src/main/java/com/ruoyi/common/core/redis/RedisCache.java
... ... @@ -136,10 +136,15 @@ public class RedisCache
136 136 * @param dataSet 缓存的数据
137 137 * @return 缓存数据的对象
138 138 */
139   - public <T> long setCacheSet(final String key, final Set<T> dataSet)
  139 + public <T> BoundSetOperations<String, T> setCacheSet(final String key, final Set<T> dataSet)
140 140 {
141   - Long count = redisTemplate.opsForSet().add(key, dataSet);
142   - return count == null ? 0 : count;
  141 + BoundSetOperations<String, T> setOperation = redisTemplate.boundSetOps(key);
  142 + Iterator<T> it = dataSet.iterator();
  143 + while (it.hasNext())
  144 + {
  145 + setOperation.add(it.next());
  146 + }
  147 + return setOperation;
143 148 }
144 149  
145 150 /**
... ...