|
|
|
@ -80,10 +80,9 @@ public class Config {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Redis key/value codec. Default is json
|
|
|
|
|
* Redis key/value codec. Default is json-codec
|
|
|
|
|
*
|
|
|
|
|
* @see org.redisson.codec.JsonJacksonCodec
|
|
|
|
|
* @see org.redisson.codec.SerializationCodec
|
|
|
|
|
* @see org.redisson.client.codec.Codec
|
|
|
|
|
*/
|
|
|
|
|
public Config setCodec(Codec codec) {
|
|
|
|
|
this.codec = codec;
|
|
|
|
@ -93,18 +92,33 @@ public class Config {
|
|
|
|
|
return codec;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Init cluster servers configuration
|
|
|
|
|
*
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
public ClusterServersConfig useClusterServers() {
|
|
|
|
|
return useClusterServers(new ClusterServersConfig());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Init cluster servers configuration by config object.
|
|
|
|
|
*
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
public ClusterServersConfig useClusterServers(ClusterServersConfig config) {
|
|
|
|
|
checkMasterSlaveServersConfig();
|
|
|
|
|
checkSentinelServersConfig();
|
|
|
|
|
checkSingleServerConfig();
|
|
|
|
|
checkElasticacheServersConfig();
|
|
|
|
|
|
|
|
|
|
if (clusterServersConfig == null) {
|
|
|
|
|
clusterServersConfig = new ClusterServersConfig();
|
|
|
|
|
clusterServersConfig = config;
|
|
|
|
|
}
|
|
|
|
|
return clusterServersConfig;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ClusterServersConfig getClusterServersConfig() {
|
|
|
|
|
return clusterServersConfig;
|
|
|
|
|
}
|
|
|
|
@ -112,7 +126,21 @@ public class Config {
|
|
|
|
|
this.clusterServersConfig = clusterServersConfig;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Init AWS Elasticache servers configuration.
|
|
|
|
|
*
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
public ElasticacheServersConfig useElasticacheServers() {
|
|
|
|
|
return useElasticacheServers(new ElasticacheServersConfig());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Init AWS Elasticache servers configuration by config object.
|
|
|
|
|
*
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
public ElasticacheServersConfig useElasticacheServers(ElasticacheServersConfig config) {
|
|
|
|
|
checkClusterServersConfig();
|
|
|
|
|
checkMasterSlaveServersConfig();
|
|
|
|
|
checkSentinelServersConfig();
|
|
|
|
@ -131,18 +159,33 @@ public class Config {
|
|
|
|
|
this.elasticacheServersConfig = elasticacheServersConfig;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Init single server configuration.
|
|
|
|
|
*
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
public SingleServerConfig useSingleServer() {
|
|
|
|
|
return useSingleServer(new SingleServerConfig());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Init single server configuration by config object.
|
|
|
|
|
*
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
public SingleServerConfig useSingleServer(SingleServerConfig config) {
|
|
|
|
|
checkClusterServersConfig();
|
|
|
|
|
checkMasterSlaveServersConfig();
|
|
|
|
|
checkSentinelServersConfig();
|
|
|
|
|
checkElasticacheServersConfig();
|
|
|
|
|
|
|
|
|
|
if (singleServerConfig == null) {
|
|
|
|
|
singleServerConfig = new SingleServerConfig();
|
|
|
|
|
singleServerConfig = config;
|
|
|
|
|
}
|
|
|
|
|
return singleServerConfig;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SingleServerConfig getSingleServerConfig() {
|
|
|
|
|
return singleServerConfig;
|
|
|
|
|
}
|
|
|
|
@ -150,16 +193,30 @@ public class Config {
|
|
|
|
|
this.singleServerConfig = singleConnectionConfig;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Init sentinel servers configuration.
|
|
|
|
|
*
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
public SentinelServersConfig useSentinelServers() {
|
|
|
|
|
return useSentinelServers(new SentinelServersConfig());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Init sentinel servers configuration by config object.
|
|
|
|
|
*
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
public SentinelServersConfig useSentinelServers(SentinelServersConfig sentinelServersConfig) {
|
|
|
|
|
checkClusterServersConfig();
|
|
|
|
|
checkSingleServerConfig();
|
|
|
|
|
checkMasterSlaveServersConfig();
|
|
|
|
|
checkElasticacheServersConfig();
|
|
|
|
|
|
|
|
|
|
if (sentinelServersConfig == null) {
|
|
|
|
|
sentinelServersConfig = new SentinelServersConfig();
|
|
|
|
|
if (this.sentinelServersConfig == null) {
|
|
|
|
|
this.sentinelServersConfig = sentinelServersConfig;
|
|
|
|
|
}
|
|
|
|
|
return sentinelServersConfig;
|
|
|
|
|
return this.sentinelServersConfig;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
@ -177,14 +234,28 @@ public class Config {
|
|
|
|
|
this.sentinelServersConfig = sentinelConnectionConfig;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Init master/slave servers configuration.
|
|
|
|
|
*
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
public MasterSlaveServersConfig useMasterSlaveServers() {
|
|
|
|
|
return useMasterSlaveServers(new MasterSlaveServersConfig());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Init master/slave servers configuration by config object.
|
|
|
|
|
*
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
public MasterSlaveServersConfig useMasterSlaveServers(MasterSlaveServersConfig config) {
|
|
|
|
|
checkClusterServersConfig();
|
|
|
|
|
checkSingleServerConfig();
|
|
|
|
|
checkSentinelServersConfig();
|
|
|
|
|
checkElasticacheServersConfig();
|
|
|
|
|
|
|
|
|
|
if (masterSlaveServersConfig == null) {
|
|
|
|
|
masterSlaveServersConfig = new MasterSlaveServersConfig();
|
|
|
|
|
masterSlaveServersConfig = config;
|
|
|
|
|
}
|
|
|
|
|
return masterSlaveServersConfig;
|
|
|
|
|
}
|
|
|
|
|