Commit 6800a12014b45908929f18d99bc56637212813ec
Committed by
Gitee
!138 修改Set可能导致嵌套的问题
Merge pull request !138 from BecomeDream/N/A
Showing
1 changed file
with
8 additions
and
3 deletions
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 | /** | ... | ... |