Merge pull request #3977 from cartermc24/master

Fix RList remove with count response when multiple items are removed
pull/4031/head
Nikita Koksharov 3 years ago committed by GitHub
commit 70a55a1cc3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -138,7 +138,7 @@ public class RedissonList<V> extends RedissonExpirable implements RList<V> {
@Override
public RFuture<Boolean> removeAsync(Object o, int count) {
return commandExecutor.writeAsync(getRawName(), codec, LREM_SINGLE, getRawName(), count, encode(o));
return commandExecutor.writeAsync(getRawName(), codec, LREM, getRawName(), count, encode(o));
}
@Override

@ -172,7 +172,7 @@ public interface RedisCommands {
RedisCommand<Void> LSET = new RedisCommand<Void>("LSET", new VoidReplayConvertor());
RedisCommand<Object> LPOP = new RedisCommand<Object>("LPOP");
RedisCommand<List<Object>> LPOP_LIST = new RedisCommand<>("LPOP", new ObjectListReplayDecoder<>());
RedisCommand<Boolean> LREM_SINGLE = new RedisCommand<Boolean>("LREM", new BooleanReplayConvertor());
RedisCommand<Boolean> LREM = new RedisCommand<Boolean>("LREM", new BooleanAmountReplayConvertor());
RedisCommand<Object> LINDEX = new RedisCommand<Object>("LINDEX");
RedisCommand<Object> LMOVE = new RedisCommand<Object>("LMOVE");
RedisCommand<Integer> LINSERT_INT = new RedisCommand<Integer>("LINSERT", new IntegerReplayConvertor());

@ -908,6 +908,22 @@ public class RedissonListTest extends BaseTest {
assertThat(list).containsExactly(2, 3, 5);
}
@Test
public void testRemoveWithCount() {
RList<Integer> list = redisson.getList("list");
list.add(1);
list.add(2);
list.add(3);
list.add(3);
list.add(4);
assertThat(list.remove(1, 5)).isTrue();
assertThat(list).containsExactly(2, 3, 3, 4);
assertThat(list.remove(3, 5)).isTrue();
assertThat(list).containsExactly(2, 4);
}
@Test
public void testSubListRemove() {
List<Integer> list = redisson.getList("list");

Loading…
Cancel
Save