Merge pull request #118 from showsoso/master

支持redis密码
This commit is contained in:
jinyu 2017-06-22 12:31:11 +08:00 committed by GitHub
commit 1a42b479ba

View File

@ -37,13 +37,23 @@ public class RedisCacheStorager<T extends Cacheable> implements
}
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.setMaxTotal(MAX_TOTAL);
jedisPoolConfig.setMaxIdle(MAX_IDLE);
jedisPoolConfig.setMaxWaitMillis(MAX_WAIT_MILLIS);
jedisPoolConfig.setTestOnBorrow(TEST_ON_BORROW);
jedisPoolConfig.setTestOnReturn(TEST_ON_RETURN);
this.jedisPool = new JedisPool(jedisPoolConfig, host, port, timeout);
return jedisPoolConfig;
}
public RedisCacheStorager(JedisPoolConfig jedisPoolConfig) {