支持redis密码
This commit is contained in:
parent
d27bc15a08
commit
a05f33d7ea
@ -37,13 +37,23 @@ public class RedisCacheStorager<T extends Cacheable> implements
|
|||||||
}
|
}
|
||||||
|
|
||||||
public RedisCacheStorager(String host, int port, int timeout) {
|
public RedisCacheStorager(String host, int port, int timeout) {
|
||||||
|
JedisPoolConfig jedisPoolConfig = defaultConfig();
|
||||||
|
this.jedisPool = new JedisPool(jedisPoolConfig, host, port, timeout);
|
||||||
|
}
|
||||||
|
|
||||||
|
public RedisCacheStorager(String host, int port, int timeout, String password) {
|
||||||
|
JedisPoolConfig jedisPoolConfig = defaultConfig();
|
||||||
|
this.jedisPool = new JedisPool(jedisPoolConfig, host, port, timeout, password);
|
||||||
|
}
|
||||||
|
|
||||||
|
private JedisPoolConfig defaultConfig(){
|
||||||
JedisPoolConfig jedisPoolConfig = new JedisPoolConfig();
|
JedisPoolConfig jedisPoolConfig = new JedisPoolConfig();
|
||||||
jedisPoolConfig.setMaxTotal(MAX_TOTAL);
|
jedisPoolConfig.setMaxTotal(MAX_TOTAL);
|
||||||
jedisPoolConfig.setMaxIdle(MAX_IDLE);
|
jedisPoolConfig.setMaxIdle(MAX_IDLE);
|
||||||
jedisPoolConfig.setMaxWaitMillis(MAX_WAIT_MILLIS);
|
jedisPoolConfig.setMaxWaitMillis(MAX_WAIT_MILLIS);
|
||||||
jedisPoolConfig.setTestOnBorrow(TEST_ON_BORROW);
|
jedisPoolConfig.setTestOnBorrow(TEST_ON_BORROW);
|
||||||
jedisPoolConfig.setTestOnReturn(TEST_ON_RETURN);
|
jedisPoolConfig.setTestOnReturn(TEST_ON_RETURN);
|
||||||
this.jedisPool = new JedisPool(jedisPoolConfig, host, port, timeout);
|
return jedisPoolConfig;
|
||||||
}
|
}
|
||||||
|
|
||||||
public RedisCacheStorager(JedisPoolConfig jedisPoolConfig) {
|
public RedisCacheStorager(JedisPoolConfig jedisPoolConfig) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user