Java Code Examples for org.redisson.api.RMapCache#clear()

The following examples show how to use org.redisson.api.RMapCache#clear() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CacheServiceRedisImpl.java    From kkFileView with Apache License 2.0 4 votes vote down vote up
private void cleanPdfCache() {
    RMapCache<String, String> pdfCache = redissonClient.getMapCache(FILE_PREVIEW_PDF_KEY);
    pdfCache.clear();
}
 
Example 2
Source File: CacheServiceRedisImpl.java    From kkFileView with Apache License 2.0 4 votes vote down vote up
private void cleanImgCache() {
    RMapCache<String, List<String>> imgCache = redissonClient.getMapCache(FILE_PREVIEW_IMGS_KEY);
    imgCache.clear();
}
 
Example 3
Source File: CacheServiceRedisImpl.java    From kkFileView with Apache License 2.0 4 votes vote down vote up
private void cleanPdfImgCache() {
    RMapCache<String, Integer> pdfImg = redissonClient.getMapCache(FILE_PREVIEW_PDF_IMGS_KEY);
    pdfImg.clear();
}
 
Example 4
Source File: RedissonMapCacheTest.java    From redisson with Apache License 2.0 3 votes vote down vote up
protected void testIdleExpiration(Consumer<RMapCache<String, Integer>> callback) throws InterruptedException {
    RMapCache<String, Integer> map = redisson.getMapCache("simple");

    callback.accept(map);

    Thread.sleep(1000);
    
    assertThat(map.get("12")).isNull();
    assertThat(map.get("14")).isEqualTo(2);
    assertThat(map.get("15")).isEqualTo(3);
    
    Thread.sleep(2000);
    
    assertThat(map.get("12")).isNull();
    assertThat(map.get("14")).isNull();
    assertThat(map.get("15")).isEqualTo(3);
    
    Thread.sleep(3000);

    assertThat(map.get("12")).isNull();
    assertThat(map.get("14")).isNull();
    assertThat(map.get("15")).isNull();

    
    map.clear();
    map.destroy();
}
 
Example 5
Source File: RedissonMapCacheTest.java    From redisson with Apache License 2.0 3 votes vote down vote up
protected void testTTLExpiration(Consumer<RMapCache<String, Integer>> callback) throws InterruptedException {
    RMapCache<String, Integer> map = redisson.getMapCache("simple");

    callback.accept(map);

    Thread.sleep(1000);
    
    assertThat(map.get("12")).isNull();
    assertThat(map.get("14")).isEqualTo(2);
    assertThat(map.get("15")).isEqualTo(3);
    
    Thread.sleep(1000);
    
    assertThat(map.get("12")).isNull();
    assertThat(map.get("14")).isNull();
    assertThat(map.get("15")).isEqualTo(3);
    
    Thread.sleep(1000);

    assertThat(map.get("12")).isNull();
    assertThat(map.get("14")).isNull();
    assertThat(map.get("15")).isNull();

    
    map.clear();
    map.destroy();
}