1

我像下面这样配置Redisson客户端,作为Singelton的一部分,通过 redisson config 提高性能的最佳实践是什么?在 Redisson 地图上使对象无效的最佳方法是什么?

Config config = new Config();
config.useSingleServer().setAddress(redisProperties.getProperty(RedisProperties.REDIS_ENDPOINT)+":"+Integer.valueOf(redisProperties.getProperty(RedisProperties.REDIS_PORT)));

config.useSingleServer().setRetryAttempts(3);
config.useSingleServer().setTimeout(10000);
config.useSingleServer().setConnectionPoolSize(500);
config.useSingleServer().setRetryInterval(2000);
redisson = (Redisson) Redisson.create(config);

使用示例:

RMapCache<String, Object> map = RedissonAcess.getInstance().getRedissonClient().getMapCache(currentDBUrl+mapName.getValue());

map.put(key, value,3,TimeUnit.HOURS);
4

0 回答 0