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");
}
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");
}
Aggregations