Connect to distributed Redis cluster.




External library function. The parameter poolConfig involves the following values:

1. testOnReturn(boolean)  #Whether connection objects will be validated before being returned.

2. blockWhenExhausted(boolean)  #Whether to block when the connection is exhausted; default is true which blocks until timeout; a false value throws an exception.

3. evictionPolicyClassName(String)  #Set the name of the eviction policy class name; default is DefaultEvictionPolicy (implement the eviction policy when the connection time exceeds the maximum idle time or the number of connections is greater than the maximum number of idle connections).

4. jmxEnabled(boolean)  #Whether to enable JMX functionality; default is true.

5. jmxNamePrefix(String)  #Set the MBean name, which is "pool" by default.

6. lifo(boolean)  #Whether to use the last-in-first-out order; default is true.

7. maxWaitMillis(long)  #Set the maximum amount of time (in miliseconds) before an exeption is thrown (BlockWhenExhausted needs to be true); with value set to be less than 0, block until the connection is established; default is -1.

8. minEvictableIdleTimeMillis(long)  #Set the minimum amount of time that a connection can be idle before being tested for eviction; default is 1800000 milliseconds (30 minutes).

  9. numTestsPerEvictionRun(int)  #Set the maximum number of connections to test during idle eviction runs; a negative value is 1/abs(n); defaut is 3.

10. softMinEvictableIdleTimeMillis(long)  #Set the minimum amount of time an object may sit idle before it is eligible for eviction; enable an eviction when idle time > this value & number of idle connections > number of idle connections, without referencing the value of minEvictableIdleTimeMillis (which is the default eviction policy).

11. testOnBorrow(boolean)  #Whether connection objects borrowed from the pool will be validated before being returned; default is true.

12. testWhileIdle(boolean)  #Return whether object sitting idle in the pool will be validated; default is false.

13. timeBetweenEvictionRunsMillis(long)  #Set the amount of time (in miliseconds) between runs of the idle object evictor threads; won’t run the evictor threads if the value is negative; default is -1.



Master node name.


The Redis database’s IP and port number, which is a string in the format of ip:port.


The Redis database’s authentication password.


Timeout value when trying to connect to the database (in seconds); can be omitted.


Connection property configuration, which is a string in the format of “key:value[,key1:value1,…]”; can be omitted.

Return value: