소스 검색

修复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();
 	}
 
 	/**