Search in sources :

Example 16 with RLexSortedSet

use of org.redisson.api.RLexSortedSet in project redisson by redisson.

the class RedissonLexSortedSetTest method testRemoveLexRange.

@Test
public void testRemoveLexRange() {
    RLexSortedSet set = redisson.getLexSortedSet("simple");
    set.add("a");
    set.add("b");
    set.add("c");
    set.add("d");
    set.add("e");
    set.add("f");
    set.add("g");
    Assertions.assertEquals(5, set.removeRange("aaa", true, "g", false));
    assertThat(set).containsExactly("a", "g");
}
Also used : RLexSortedSet(org.redisson.api.RLexSortedSet) Test(org.junit.jupiter.api.Test)

Example 17 with RLexSortedSet

use of org.redisson.api.RLexSortedSet in project redisson by redisson.

the class RedissonLexSortedSetTest method testLexRangeTailReversed.

@Test
public void testLexRangeTailReversed() {
    RLexSortedSet set = redisson.getLexSortedSet("simple");
    Assertions.assertTrue(set.add("a"));
    Assertions.assertFalse(set.add("a"));
    Assertions.assertTrue(set.add("b"));
    Assertions.assertTrue(set.add("c"));
    Assertions.assertTrue(set.add("d"));
    Assertions.assertTrue(set.add("e"));
    Assertions.assertTrue(set.add("f"));
    Assertions.assertTrue(set.add("g"));
    assertThat(set.rangeTailReversed("c", false)).containsExactly("g", "f", "e", "d");
    assertThat(set.rangeTailReversed("c", true)).containsExactly("g", "f", "e", "d", "c");
    assertThat(set.rangeTailReversed("c", false, 1, 2)).containsExactly("f", "e");
    assertThat(set.rangeTailReversed("c", true, 2, 2)).containsExactly("e", "d");
}
Also used : RLexSortedSet(org.redisson.api.RLexSortedSet) Test(org.junit.jupiter.api.Test)

Aggregations

RLexSortedSet (org.redisson.api.RLexSortedSet)17 Test (org.junit.jupiter.api.Test)15 List (java.util.List)1 Test (org.junit.Test)1 ScoredEntry (org.redisson.client.protocol.ScoredEntry)1