I am not sure how to create a RedissonClient object in the application. 1- Should this object be created for every transaction or 2- The object should singleton per JVM? 3- Only one object for all the services?
Currently, my setup is an embedded Jetty with Jersey APIs for 3 Services running on a different set of Kubernetes pods and Redis setup is 3 + 3 master and slave config.
Current config looks like this.
public class RedisTemplate {
public static final RedissonClient REDISCLIENT;
private static final Logger logger = LogManager.getLogger(RedisTemplate.class);
public static final String redisMaster = "redis-cluster";
static {
Config config = new Config();
logger.info("redis config for server");
config.useClusterServers().addNodeAddress("redis://" + redisMaster + ":6379");
REDISCLIENT = Redisson.create(config);
}
}