Search in sources :

Example 1 with MsgPackJacksonCodec

use of org.redisson.codec.MsgPackJacksonCodec in project redisson by redisson.

the class RedissonMapCacheTest method testContainsValue.

@Test
public void testContainsValue() throws InterruptedException {
    RMapCache<SimpleKey, SimpleValue> map = redisson.getMapCache("simple01", new MsgPackJacksonCodec());
    Assert.assertFalse(map.containsValue(new SimpleValue("34")));
    map.put(new SimpleKey("33"), new SimpleValue("44"), 1, TimeUnit.SECONDS);
    Assert.assertTrue(map.containsValue(new SimpleValue("44")));
    Assert.assertFalse(map.containsValue(new SimpleValue("34")));
    Thread.sleep(1000);
    Assert.assertFalse(map.containsValue(new SimpleValue("44")));
}
Also used : MsgPackJacksonCodec(org.redisson.codec.MsgPackJacksonCodec) Test(org.junit.Test)

Example 2 with MsgPackJacksonCodec

use of org.redisson.codec.MsgPackJacksonCodec in project redisson by redisson.

the class RedissonSetCacheReactiveTest method testScheduler.

@Test
public void testScheduler() throws InterruptedException {
    RSetCacheReactive<String> cache = redisson.getSetCache("simple33", new MsgPackJacksonCodec());
    Assert.assertFalse(sync(cache.contains("33")));
    Assert.assertTrue(sync(cache.add("33", 5, TimeUnit.SECONDS)));
    Thread.sleep(11000);
    Assert.assertEquals(0, sync(cache.size()).intValue());
}
Also used : MsgPackJacksonCodec(org.redisson.codec.MsgPackJacksonCodec) Test(org.junit.Test)

Example 3 with MsgPackJacksonCodec

use of org.redisson.codec.MsgPackJacksonCodec in project redisson by redisson.

the class RedissonSetCacheTest method testScheduler.

@Test
public void testScheduler() throws InterruptedException {
    RSetCache<String> cache = redisson.getSetCache("simple33", new MsgPackJacksonCodec());
    Assert.assertFalse(cache.contains("33"));
    Assert.assertTrue(cache.add("33", 5, TimeUnit.SECONDS));
    Thread.sleep(11000);
    Assert.assertEquals(0, cache.size());
}
Also used : MsgPackJacksonCodec(org.redisson.codec.MsgPackJacksonCodec) Test(org.junit.Test)

Example 4 with MsgPackJacksonCodec

use of org.redisson.codec.MsgPackJacksonCodec in project redisson by redisson.

the class RedissonMapCacheReactiveTest method testScheduler.

@Test
public void testScheduler() throws InterruptedException {
    RMapCacheReactive<SimpleKey, SimpleValue> map = redisson.getMapCache("simple", new MsgPackJacksonCodec());
    Assert.assertNull(sync(map.get(new SimpleKey("33"))));
    sync(map.put(new SimpleKey("33"), new SimpleValue("44"), 5, TimeUnit.SECONDS));
    Thread.sleep(11000);
    Assert.assertEquals(0, sync(map.size()).intValue());
}
Also used : MsgPackJacksonCodec(org.redisson.codec.MsgPackJacksonCodec) Test(org.junit.Test)

Example 5 with MsgPackJacksonCodec

use of org.redisson.codec.MsgPackJacksonCodec in project redisson by redisson.

the class RedissonMapCacheReactiveTest method testPutGet.

@Test
public void testPutGet() throws InterruptedException {
    RMapCacheReactive<SimpleKey, SimpleValue> map = redisson.getMapCache("simple01", new MsgPackJacksonCodec());
    Assert.assertNull(sync(map.get(new SimpleKey("33"))));
    sync(map.put(new SimpleKey("33"), new SimpleValue("44"), 2, TimeUnit.SECONDS));
    SimpleValue val1 = sync(map.get(new SimpleKey("33")));
    Assert.assertEquals("44", val1.getValue());
    Thread.sleep(1000);
    Assert.assertEquals(1, sync(map.size()).intValue());
    SimpleValue val2 = sync(map.get(new SimpleKey("33")));
    Assert.assertEquals("44", val2.getValue());
    Assert.assertEquals(1, sync(map.size()).intValue());
    Thread.sleep(1000);
    Assert.assertNull(sync(map.get(new SimpleKey("33"))));
}
Also used : MsgPackJacksonCodec(org.redisson.codec.MsgPackJacksonCodec) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)8 MsgPackJacksonCodec (org.redisson.codec.MsgPackJacksonCodec)8