Feature - addListener() method added RLexSortedSet object.

pull/5652/head
Nikita Koksharov 12 months ago
parent 665fd9912b
commit d73e113f0e

@ -258,4 +258,18 @@ public interface RLexSortedSet extends RLexSortedSetAsync, RSortedSet<String>, R
*/
Collection<String> range(int startIndex, int endIndex);
/**
* Adds object event listener
*
* @see org.redisson.api.listener.TrackingListener
* @see org.redisson.api.listener.ScoredSortedSetAddListener
* @see org.redisson.api.listener.ScoredSortedSetRemoveListener
* @see org.redisson.api.ExpiredObjectListener
* @see org.redisson.api.DeletedObjectListener
*
* @param listener - object event listener
* @return listener id
*/
int addListener(ObjectListener listener);
}

@ -279,4 +279,18 @@ public interface RLexSortedSetAsync extends RCollectionAsync<String> {
*/
RFuture<Integer> revRankAsync(String o);
/**
* Adds object event listener
*
* @see org.redisson.api.listener.TrackingListener
* @see org.redisson.api.listener.ScoredSortedSetAddListener
* @see org.redisson.api.listener.ScoredSortedSetRemoveListener
* @see org.redisson.api.ExpiredObjectListener
* @see org.redisson.api.DeletedObjectListener
*
* @param listener object event listener
* @return listener id
*/
RFuture<Integer> addListenerAsync(ObjectListener listener);
}

@ -3,13 +3,37 @@ package org.redisson;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
import org.redisson.api.RLexSortedSet;
import org.redisson.api.listener.ScoredSortedSetAddListener;
import java.util.Arrays;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
import static org.assertj.core.api.Assertions.assertThat;
public class RedissonLexSortedSetTest extends RedisDockerTest {
@Test
public void testAddListener() {
testWithParams(redisson -> {
RLexSortedSet al = redisson.getLexSortedSet("test");
CountDownLatch latch = new CountDownLatch(1);
al.addListener(new ScoredSortedSetAddListener() {
@Override
public void onAdd(String name) {
latch.countDown();
}
});
al.add("abc");
try {
assertThat(latch.await(1, TimeUnit.SECONDS)).isTrue();
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
}, NOTIFY_KEYSPACE_EVENTS, "Ez");
}
@Test
public void testAll() {
RLexSortedSet set = redisson.getLexSortedSet("simple");

Loading…
Cancel
Save