From 382f50eb983ea8b8b147f2affdf70e2868aa8f91 Mon Sep 17 00:00:00 2001 From: Nikita Date: Wed, 30 Mar 2016 10:47:47 +0300 Subject: [PATCH] RScoredSortedSet.removeAllAsync & removeAll methods optimization --- .../java/org/redisson/RedissonScoredSortedSet.java | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/main/java/org/redisson/RedissonScoredSortedSet.java b/src/main/java/org/redisson/RedissonScoredSortedSet.java index e4755f679..ee6724f9a 100644 --- a/src/main/java/org/redisson/RedissonScoredSortedSet.java +++ b/src/main/java/org/redisson/RedissonScoredSortedSet.java @@ -330,12 +330,11 @@ public class RedissonScoredSortedSet extends RedissonExpirable implements RSc @Override public Future removeAllAsync(Collection c) { return commandExecutor.evalWriteAsync(getName(), codec, new RedisCommand("EVAL", new BooleanReplayConvertor(), 4, ValueType.OBJECTS), - "local v = 0 " + - "for i = 0, table.getn(ARGV), 1 do " - + "if redis.call('zrem', KEYS[1], ARGV[i]) == 1 " - + "then v = 1 end " - +"end " - + "return v ", + "local v = 0;" + + "for i=1, #ARGV, 5000 do " + + "v = v + redis.call('zrem', KEYS[1], unpack(ARGV, i, math.min(i+4999, #ARGV))); " + + "end " + + "return v > 0;", Collections.singletonList(getName()), c.toArray()); }