瀏覽代碼

修复reddison不能批量删除的bug。

sxq 3 年之前
父節點
當前提交
0fe064b8a2
共有 1 個文件被更改,包括 6 次插入2 次删除
  1. 6 2
      ruoyi-common/src/main/java/com/ruoyi/common/core/redis/RedisCache.java

+ 6 - 2
ruoyi-common/src/main/java/com/ruoyi/common/core/redis/RedisCache.java

@@ -96,8 +96,12 @@ public class RedisCache {
 	 * @param collection 多个对象
 	 * @return
 	 */
-	public long deleteObject(final Collection collection) {
-		return redissonClient.getKeys().delete(Arrays.toString(collection.toArray()));
+	public void deleteObject(final Collection collection) {
+		RBatch batch = redissonClient.createBatch();
+		collection.forEach(t->{
+			batch.getBucket(t.toString()).deleteAsync();
+		});
+		batch.execute();
 	}
 
 	/**