org.redisson.Redisson Java Examples

The following examples show how to use org.redisson.Redisson. 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: RedissonAutoConfig.java    From kk-anti-reptile with Apache License 2.0 7 votes vote down vote up
@Bean(destroyMethod = "shutdown")
@ConditionalOnMissingBean
RedissonClient redisson() throws Exception {
    Config config = new Config();
    config.useSingleServer().setAddress(address)
            .setConnectionMinimumIdleSize(connectionMinimumIdleSize)
            .setConnectionPoolSize(connectionPoolSize)
            .setDatabase(database)
            .setDnsMonitoringInterval(dnsMonitoringInterval)
            .setSubscriptionConnectionMinimumIdleSize(subscriptionConnectionMinimumIdleSize)
            .setSubscriptionConnectionPoolSize(subscriptionConnectionPoolSize)
            .setSubscriptionsPerConnection(subscriptionsPerConnection)
            .setClientName(clientName)
            .setRetryAttempts(retryAttempts)
            .setRetryInterval(retryInterval)
            .setTimeout(timeout)
            .setConnectTimeout(connectTimeout)
            .setIdleConnectionTimeout(idleConnectionTimeout)
            .setPassword(password);
    Codec codec=(Codec) ClassUtils.forName(getCodec(), ClassUtils.getDefaultClassLoader()).newInstance();
    config.setCodec(codec);
    config.setEventLoopGroup(new NioEventLoopGroup());
    return Redisson.create(config);
}
 
Example #2
Source File: RedissonRegionFactory.java    From redisson with Apache License 2.0 6 votes vote down vote up
@Override
protected DomainDataStorageAccess createDomainDataStorageAccess(DomainDataRegionConfig regionConfig,
        DomainDataRegionBuildingContext buildingContext) {
    String defaultKey = null;
    if (!regionConfig.getCollectionCaching().isEmpty()) {
        defaultKey = COLLECTION_DEF;
    } else if (!regionConfig.getEntityCaching().isEmpty()) {
        defaultKey = ENTITY_DEF;
    } else if (!regionConfig.getNaturalIdCaching().isEmpty()) {
        defaultKey = NATURAL_ID_DEF;
    } else {
        throw new IllegalArgumentException("Unable to determine entity cache type!");
    }
    
    RMapCache<Object, Object> mapCache = getCache(regionConfig.getRegionName(), buildingContext.getSessionFactory().getProperties(), defaultKey);
    return new RedissonStorage(mapCache, ((Redisson)redisson).getConnectionManager(), buildingContext.getSessionFactory().getProperties(), defaultKey);
}
 
Example #3
Source File: RedissonRegionFactory.java    From redisson with Apache License 2.0 6 votes vote down vote up
protected RedissonClient createRedissonClient(Properties properties) {
    Config config = null;
    if (!properties.containsKey(REDISSON_CONFIG_PATH)) {
        config = loadConfig(RedissonRegionFactory.class.getClassLoader(), "redisson.json");
        if (config == null) {
            config = loadConfig(RedissonRegionFactory.class.getClassLoader(), "redisson.yaml");
        }
    } else {
        String configPath = ConfigurationHelper.getString(REDISSON_CONFIG_PATH, properties);
        config = loadConfig(RedissonRegionFactory.class.getClassLoader(), configPath);
        if (config == null) {
            config = loadConfig(configPath);
        }
    }
    
    if (config == null) {
        throw new CacheException("Unable to locate Redisson configuration");
    }
    
    return Redisson.create(config);
}
 
Example #4
Source File: RemoteServiceExamples.java    From redisson-examples with Apache License 2.0 6 votes vote down vote up
public static void main(String[] args) {
    // connects to 127.0.0.1:6379 by default
    RedissonClient server = Redisson.create();
    RedissonClient client = Redisson.create();
    try {
        server.getRemoteService().register(RemoteInterface.class, new RemoteImpl());

        RemoteInterface service = client.getRemoteService().get(RemoteInterface.class);

        service.myMethod(21L);

    } finally {
        client.shutdown();
        server.shutdown();
    }

}
 
Example #5
Source File: RedisLockTest.java    From conductor with Apache License 2.0 6 votes vote down vote up
@BeforeClass
public static void setUp() throws Exception {
    String testServerAddress = "redis://127.0.0.1:6371";
    redisServer = new RedisServer(6371);
    if (redisServer.isActive()) {
        redisServer.stop();
    }
    redisServer.start();

    RedisLockConfiguration redisLockConfiguration = new SystemPropertiesRedisLockConfiguration() {
        @Override
        public String getRedisServerAddress() {
            return testServerAddress;
        }
    };

    Config redissonConfig = new Config();
    redissonConfig.useSingleServer().setAddress(testServerAddress).setTimeout(10000);
    redisLock = new RedisLock((Redisson) Redisson.create(redissonConfig), redisLockConfiguration);

    // Create another instance of redisson for tests.
    config = new Config();
    config.useSingleServer().setAddress(testServerAddress).setTimeout(10000);
    redisson = Redisson.create(config);
}
 
Example #6
Source File: RedissonTest.java    From java-specialagent with Apache License 2.0 6 votes vote down vote up
@Test
public void test(final MockTracer tracer) {
  final Config config = new Config();
  config.useSingleServer().setAddress("redis://127.0.0.1:6379");

  final RedissonClient redissonClient = Redisson.create(config);
  final RMap<String,String> map = redissonClient.getMap("map");

  map.put("key", "value");
  assertEquals("value", map.get("key"));

  final List<MockSpan> spans = tracer.finishedSpans();
  assertEquals(2, spans.size());

  redissonClient.shutdown();
}
 
Example #7
Source File: TopicExamples.java    From redisson-examples with Apache License 2.0 6 votes vote down vote up
public static void main(String[] args) throws InterruptedException {
    // connects to 127.0.0.1:6379 by default
    RedissonClient redisson = Redisson.create();

    CountDownLatch latch = new CountDownLatch(1);
    
    RTopic topic = redisson.getTopic("topic2");
    topic.addListener(String.class, new MessageListener<String>() {
        @Override
        public void onMessage(CharSequence channel, String msg) {
            latch.countDown();
        }
    });
    
    topic.publish("msg");
    latch.await();
    
    redisson.shutdown();
}
 
Example #8
Source File: KlockAutoConfiguration.java    From spring-boot-klock-starter with Apache License 2.0 6 votes vote down vote up
@Bean(destroyMethod = "shutdown")
@ConditionalOnMissingBean
RedissonClient redisson() throws Exception {
    Config config = new Config();
    if(klockConfig.getClusterServer()!=null){
        config.useClusterServers().setPassword(klockConfig.getPassword())
                .addNodeAddress(klockConfig.getClusterServer().getNodeAddresses());
    }else {
        config.useSingleServer().setAddress(klockConfig.getAddress())
                .setDatabase(klockConfig.getDatabase())
                .setPassword(klockConfig.getPassword());
    }
    Codec codec=(Codec) ClassUtils.forName(klockConfig.getCodec(),ClassUtils.getDefaultClassLoader()).newInstance();
    config.setCodec(codec);
    config.setEventLoopGroup(new NioEventLoopGroup());
    return Redisson.create(config);
}
 
Example #9
Source File: RedissonConnectionFactory.java    From redisson with Apache License 2.0 6 votes vote down vote up
@Override
public RedisSentinelConnection getSentinelConnection() {
    if (!redisson.getConfig().isSentinelConfig()) {
        throw new InvalidDataAccessResourceUsageException("Redisson is not in Sentinel mode");
    }
    
    SentinelConnectionManager manager = ((SentinelConnectionManager)((Redisson)redisson).getConnectionManager());
    for (RedisClient client : manager.getSentinels()) {
        org.redisson.client.RedisConnection connection = client.connect();
        try {
            String res = connection.sync(RedisCommands.PING);
            if ("pong".equalsIgnoreCase(res)) {
                return new RedissonSentinelConnection(connection);
            }
        } catch (Exception e) {
            log.warn("Can't connect to " + client, e);
            connection.closeAsync();
        }
    }
    
    throw new InvalidDataAccessResourceUsageException("Sentinels are not found");
}
 
Example #10
Source File: AtomicDoubleExamples.java    From redisson-examples with Apache License 2.0 6 votes vote down vote up
public static void main(String[] args) {
    // connects to 127.0.0.1:6379 by default
    RedissonClient redisson = Redisson.create();

    RAtomicDouble atomicDouble = redisson.getAtomicDouble("myDouble");
    atomicDouble.getAndDecrement();
    atomicDouble.getAndIncrement();
    
    atomicDouble.addAndGet(10.323);
    atomicDouble.compareAndSet(29.4, 412.91);
    
    atomicDouble.decrementAndGet();
    atomicDouble.incrementAndGet();
    
    atomicDouble.getAndAdd(302.00);
    atomicDouble.getAndDecrement();
    atomicDouble.getAndIncrement();
    
    redisson.shutdown();
}
 
Example #11
Source File: BucketExamples.java    From redisson-examples with Apache License 2.0 6 votes vote down vote up
public static void main(String[] args) {
    RedissonClient redisson = Redisson.create();
    
    RBucket<String> bucket = redisson.getBucket("test");
    bucket.set("123");
    boolean isUpdated = bucket.compareAndSet("123", "4934");
    String prevObject = bucket.getAndSet("321");
    boolean isSet = bucket.trySet("901");
    long objectSize = bucket.size();
    
    // set with expiration
    bucket.set("value", 10, TimeUnit.SECONDS);
    boolean isNewSet = bucket.trySet("nextValue", 10, TimeUnit.SECONDS);
    
    redisson.shutdown();
}
 
Example #12
Source File: RedissonManager.java    From game-server with MIT License 6 votes vote down vote up
/**
 * 连接服务器
 * 
 * @author JiangZhiYong
 * @QQ 359135103 2017年9月15日 下午3:36:06
 * @param configPath
 */
public static void connectRedis(String configPath) {
	if (redisson != null) {
		LOGGER.warn("Redisson客户端已经连接");
	}
	redissonClusterConfig = FileUtil.getConfigXML(configPath, "redissonClusterConfig.xml",
			RedissonClusterConfig.class);
	if (redissonClusterConfig == null) {
		LOGGER.warn("{}/redissonClusterConfig.xml文件不存在", configPath);
		System.exit(0);
	}
	Config config = new Config();
	config.setCodec(new FastJsonCodec());
	ClusterServersConfig clusterServersConfig = config.useClusterServers();
	clusterServersConfig.setScanInterval(redissonClusterConfig.getScanInterval()); // 集群状态扫描间隔时间,单位是毫秒
	// 可以用"rediss://"来启用SSL连接
	redissonClusterConfig.getNodes().forEach(url -> clusterServersConfig.addNodeAddress(url));
	clusterServersConfig.setReadMode(redissonClusterConfig.getReadMode());
	clusterServersConfig.setSubscriptionMode(redissonClusterConfig.getSubscriptionMode());
	redisson = Redisson.create(config);
}
 
Example #13
Source File: SortedSetExamples.java    From redisson-examples with Apache License 2.0 6 votes vote down vote up
public static void main(String[] args) {
    // connects to 127.0.0.1:6379 by default
    RedissonClient redisson = Redisson.create();
    
    RSortedSet<String> sortedSet = redisson.getSortedSet("mySortedSet");
    sortedSet.add("1");
    sortedSet.add("2");
    sortedSet.add("3");
    
    for (String string : sortedSet) {
        // iteration through bulk loaded values
    }
    
    String firstValue = sortedSet.first();
    String lastValue = sortedSet.last();
    
    boolean removedValue = sortedSet.remove("1");
    sortedSet.removeAll(Arrays.asList("1", "2", "3"));
    sortedSet.containsAll(Arrays.asList("4", "1", "0"));
    
    redisson.shutdown();
}
 
Example #14
Source File: ExecutorServiceExamples.java    From redisson-examples with Apache License 2.0 6 votes vote down vote up
public static void main(String[] args) {
    Config config = new Config();
    config.useClusterServers()
        .addNodeAddress("127.0.0.1:7001", "127.0.0.1:7002", "127.0.0.1:7003");
    
    RedissonClient redisson = Redisson.create(config);

    RedissonNodeConfig nodeConfig = new RedissonNodeConfig(config);
    nodeConfig.setExecutorServiceWorkers(Collections.singletonMap("myExecutor", 1));
    RedissonNode node = RedissonNode.create(nodeConfig);
    node.start();

    RExecutorService e = redisson.getExecutorService("myExecutor");
    e.execute(new RunnableTask());
    e.submit(new CallableTask());
    
    e.shutdown();
    node.shutdown();
}
 
Example #15
Source File: BucketExamples.java    From redisson-examples with Apache License 2.0 6 votes vote down vote up
public static void main(String[] args) {
    // connects to 127.0.0.1:6379 by default
    RedissonClient redisson = Redisson.create();
    
    RBucket<String> bucket = redisson.getBucket("test");
    bucket.set("123");
    boolean isUpdated = bucket.compareAndSet("123", "4934");
    String prevObject = bucket.getAndSet("321");
    boolean isSet = bucket.trySet("901");
    long objectSize = bucket.size();
    
    // set with expiration
    bucket.set("value", 10, TimeUnit.SECONDS);
    boolean isNewSet = bucket.trySet("nextValue", 10, TimeUnit.SECONDS);
    
    redisson.shutdown();
}
 
Example #16
Source File: RedissonBatchRxTest.java    From redisson with Apache License 2.0 6 votes vote down vote up
@Test
public void testBatchBigRequest() {
    Config config = BaseTest.createConfig();
    config.useSingleServer().setTimeout(15000);
    RedissonRxClient redisson = Redisson.createRx(config);

    RBatchRx batch = redisson.createBatch(batchOptions);
    for (int i = 0; i < 210; i++) {
        batch.getMap("test").fastPut("1", "2");
        batch.getMap("test").fastPut("2", "3");
        batch.getMap("test").put("2", "5");
        batch.getAtomicLong("counter").incrementAndGet();
        batch.getAtomicLong("counter").incrementAndGet();
    }
    BatchResult<?> res = sync(batch.execute());
    Assert.assertEquals(210*5, res.getResponses().size());
    
    redisson.shutdown();
}
 
Example #17
Source File: JCache.java    From redisson with Apache License 2.0 6 votes vote down vote up
public JCache(JCacheManager cacheManager, Redisson redisson, String name, JCacheConfiguration<K, V> config, boolean hasOwnRedisson) {
    super(redisson.getConfig().getCodec(), redisson.getCommandExecutor(), name);
    
    this.hasOwnRedisson = hasOwnRedisson;
    this.redisson = redisson;
    
    Factory<CacheLoader<K, V>> cacheLoaderFactory = config.getCacheLoaderFactory();
    if (cacheLoaderFactory != null) {
        cacheLoader = cacheLoaderFactory.create();
    }
    Factory<CacheWriter<? super K, ? super V>> cacheWriterFactory = config.getCacheWriterFactory();
    if (config.getCacheWriterFactory() != null) {
        cacheWriter = (CacheWriter<K, V>) cacheWriterFactory.create();
    }
    
    this.cacheManager = cacheManager;
    this.config = config;
    
    redisson.getEvictionScheduler().scheduleJCache(getName(), getTimeoutSetName(), getExpiredChannelName());
    
    for (CacheEntryListenerConfiguration<K, V> listenerConfig : config.getCacheEntryListenerConfigurations()) {
        registerCacheEntryListener(listenerConfig, false);
    }
}
 
Example #18
Source File: RedissonLockProviderIntegrationTest.java    From ShedLock with Apache License 2.0 5 votes vote down vote up
private static RedisConnectionFactory createRedissonConnectionFactory() {
    Config config = new Config();
    config.useSingleServer()
        .setAddress("redis://" + HOST + ":" + PORT);
    RedissonClient redisson = Redisson.create(config);
    return new RedissonConnectionFactory(redisson);
}
 
Example #19
Source File: BeihuRedissonConfiguration.java    From beihu-boot with Apache License 2.0 5 votes vote down vote up
@Bean
@ConditionalOnMissingBean
public RedissonClient getRedisson() {

    Config config = new Config();

    if (redisProperties.getSentinel() != null) {
        RedisProperties.Sentinel sentinel = redisProperties.getSentinel();
        config.useSentinelServers()
                .setDatabase(redisProperties.getDatabase())
                .setMasterName(sentinel.getMaster())
                .addSentinelAddress(formatNodes(sentinel.getNodes()))
                .setPassword(redisProperties.getPassword());
    } else if (redisProperties.getCluster() != null) {
        RedisProperties.Cluster cluster = redisProperties.getCluster();
        config.useClusterServers()
                .addNodeAddress(formatNodes(cluster.getNodes()))
                .setPassword(redisProperties.getPassword());
    } else if (StringUtils.hasText(redisProperties.getUrl())) {
        config.useSingleServer().setAddress(redisProperties.getUrl())
                .setPassword(redisProperties.getPassword());
    } else {
        config.useSingleServer()
                .setAddress(MessageFormat.format("redis://{0}:{1}",
                        redisProperties.getHost(), String.valueOf(redisProperties.getPort())))
                .setPassword(redisProperties.getPassword());
    }
    return Redisson.create(config);
}
 
Example #20
Source File: ListMultimapCacheExamples.java    From redisson-examples with Apache License 2.0 5 votes vote down vote up
public static void main(String[] args) {
    // connects to 127.0.0.1:6379 by default
    RedissonClient redisson = Redisson.create();
    
    RListMultimapCache<String, Integer> multimap = redisson.getListMultimapCache("myMultimap");
    multimap.put("1", 1);
    multimap.put("1", 2);
    multimap.put("1", 3);
    multimap.put("2", 5);
    multimap.put("2", 6);
    multimap.put("4", 7);
    
    // set ttl = 10 seconds 
    multimap.expireKey("1", 10, TimeUnit.SECONDS);
    
    RList<Integer> values1 = multimap.get("1");
    RList<Integer> values2 = multimap.get("2");
    
    boolean hasEntry = multimap.containsEntry("1", 3);
    Collection<Entry<String, Integer>> entries = multimap.entries();
    Collection<Integer> values = multimap.values();
    
    boolean isRemoved = multimap.remove("1", 3);
    List<Integer> removedValues = multimap.removeAll("1");
    
    Collection<? extends Integer> newValues = Arrays.asList(5, 6, 7, 8, 9);
    boolean isNewKey = multimap.putAll("5", newValues);
    
    List<Integer> oldValues = multimap.replaceValues("2", newValues);
    List<Integer> allValues = multimap.getAll("2");

    long keysRemoved = multimap.fastRemove("2", "32");
    
    redisson.shutdown();
}
 
Example #21
Source File: MainModule.java    From kyoko with MIT License 5 votes vote down vote up
@Singleton
@Provides
RedissonRxClient redisson(Vertx vertx) {
    try {
        var redisConfig = Settings.instance().configureRedis();
        redisConfig.setEventLoopGroup(vertx.nettyEventLoopGroup());
        return Redisson.createRx(redisConfig);
    } catch (Exception e) {
        logger.error("Cannot create Redis client!", e);
        return null;
    }
}
 
Example #22
Source File: RedissonRegionFactory.java    From redisson with Apache License 2.0 5 votes vote down vote up
@Override
public CollectionRegion buildCollectionRegion(String regionName, Properties properties,
        CacheDataDescription metadata) throws CacheException {
    log.debug("Building collection cache region: " + regionName);
    
    RMapCache<Object, Object> mapCache = getCache(regionName, properties, COLLECTION_DEF);
    return new RedissonCollectionRegion(mapCache, ((Redisson)redisson).getConnectionManager(),this, metadata, settings, properties, COLLECTION_DEF, cacheKeysFactory);
}
 
Example #23
Source File: RedisTransactionManagerTestCase.java    From jstarcraft-core with Apache License 2.0 5 votes vote down vote up
@Before
public void testBefore() {
    // 注意此处的编解码器
    Codec codec = new JsonJacksonCodec();
    Config configuration = new Config();
    configuration.setCodec(codec);
    configuration.useSingleServer().setAddress("redis://127.0.0.1:6379");
    redisson = (Redisson) Redisson.create(configuration);
    keys = redisson.getKeys();
    keys.flushdb();
}
 
Example #24
Source File: JCacheManager.java    From redisson with Apache License 2.0 5 votes vote down vote up
JCacheManager(Redisson redisson, ClassLoader classLoader, CachingProvider cacheProvider, Properties properties, URI uri) {
    super();
    this.classLoader = classLoader;
    this.cacheProvider = cacheProvider;
    this.properties = properties;
    this.uri = uri;
    this.redisson = redisson;
}
 
Example #25
Source File: RedisQuantityAttribute.java    From jstarcraft-ai with Apache License 2.0 5 votes vote down vote up
public RedisQuantityAttribute(String name, Class<T> type, Redisson redisson) {
    this.name = name;
    this.type = type;
    this.maximumKey = name + maximumSuffix;
    this.minimumKey = name + minimumSuffix;
    this.maximumCache = Float.NEGATIVE_INFINITY;
    this.minimumCache = Float.POSITIVE_INFINITY;
    this.script = redisson.getScript();
    this.maximumSignature = script.scriptLoad(maximumLua);
    this.minimumSignature = script.scriptLoad(minimumLua);
    this.maximumAtomic = redisson.getAtomicDouble(maximumKey);
    this.minimumAtomic = redisson.getAtomicDouble(minimumKey);
}
 
Example #26
Source File: RedisQualityAttribute.java    From jstarcraft-ai with Apache License 2.0 5 votes vote down vote up
public RedisQualityAttribute(String name, Class<T> type, int minimunSize, int maximunSize, Redisson redisson) {
    this.name = name;
    this.type = type;
    this.indexKey = name + indexSuffix;
    this.sizeKey = name + sizeSuffix;
    Builder<T, Integer> builder = new Builder<>();
    builder.initialCapacity(minimunSize);
    builder.maximumWeightedCapacity(maximunSize);
    this.indexCache = builder.build();
    this.script = redisson.getScript();
    this.indexSignature = script.scriptLoad(indexLua);
    this.sizeAtomic = redisson.getAtomicLong(sizeKey);
}
 
Example #27
Source File: RedisConfig.java    From spring-boot-start-current with Apache License 2.0 5 votes vote down vote up
/**
 * <a href="https://github.com/redisson/redisson/wiki/%E7%9B%AE%E5%BD%95">redisson文档</a>
 */
@Bean( destroyMethod = "shutdown" )
public RedissonClient redisson (){
    Config config = new Config();
    config.useSingleServer()
 .setAddress( this.getRedissonAddress( host , port ) )
 .setPassword( password )
 .setDatabase( database );
    return Redisson.create( config );
}
 
Example #28
Source File: RedissonManager.java    From redis-distributed-lock with Apache License 2.0 5 votes vote down vote up
@PostConstruct
private void init() {
    try {
        config.useSingleServer().setAddress(
                        new StringBuilder("redis://")
                                .append(redisIp).append(":").append(redisPort).toString());
        redisson = (Redisson) Redisson.create(config);
        LOGGER.info("初始化Redisson结束");
    } catch (Exception e) {
        LOGGER.error("Redisson init error", e);
        e.printStackTrace();
    }
}
 
Example #29
Source File: RedissonManager.java    From redis-distributed-lock with Apache License 2.0 5 votes vote down vote up
public RedissonManager(RedissonProperties redissonProperties) {
    try {
        config = RedissonConfigFactory.getInstance().createConfig(redissonProperties);
        redisson = (Redisson) Redisson.create(config);
    } catch (Exception e) {
        LOGGER.error("Redisson init error", e);
        throw new IllegalArgumentException("please input correct configurations," +
                "connectionType must in standalone/sentinel/cluster/masterslave");        }
}
 
Example #30
Source File: RedissonBatchRxTest.java    From redisson with Apache License 2.0 5 votes vote down vote up
@Test
public void testWriteTimeout() throws InterruptedException {
    Config config = BaseTest.createConfig();
    config.useSingleServer().setRetryInterval(700).setTimeout(1500);
    RedissonRxClient redisson = Redisson.createRx(config);

    RBatchRx batch = redisson.createBatch(batchOptions);
    RMapCacheRx<String, String> map = batch.getMapCache("test");
    int total = 10000;
    for (int i = 0; i < total; i++) {
        map.put("" + i, "" + i, 5, TimeUnit.MINUTES);
        if (batchOptions.getExecutionMode() == ExecutionMode.REDIS_WRITE_ATOMIC) {
            if (i % 100 == 0) {
                Thread.sleep(10);
            }
        }
    }
    
    long s = System.currentTimeMillis();
    sync(batch.execute());
    long executionTime = System.currentTimeMillis() - s;
    if (batchOptions.getExecutionMode() == ExecutionMode.IN_MEMORY) {
        assertThat(executionTime).isLessThan(1000);
    } else {
        assertThat(executionTime).isLessThan(300);
    }
    assertThat(sync(redisson.getMapCache("test").size())).isEqualTo(total);
    redisson.shutdown();
}