Java Code Examples for redis.clients.jedis.JedisPoolConfig#setLifo()

The following examples show how to use redis.clients.jedis.JedisPoolConfig#setLifo() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: RedisUtils.java    From J2Cache with Apache License 2.0 6 votes vote down vote up
/**
 * 初始化 Redis 连接池
 * @param props j2cache.properties
 * @param prefix configuration prefix
 * @return redis connection pool configuration object
 */
public final static JedisPoolConfig newPoolConfig(Properties props, String prefix) {
    JedisPoolConfig cfg = new JedisPoolConfig();
    cfg.setMaxTotal(Integer.valueOf(props.getProperty(key(prefix,"maxTotal"), "-1")));
    cfg.setMaxIdle(Integer.valueOf(props.getProperty(key(prefix,"maxIdle"), "100")));
    cfg.setMaxWaitMillis(Integer.valueOf(props.getProperty(key(prefix,"maxWaitMillis"), "100")));
    cfg.setMinEvictableIdleTimeMillis(Integer.valueOf(props.getProperty(key(prefix,"minEvictableIdleTimeMillis"), "864000000")));
    cfg.setMinIdle(Integer.valueOf(props.getProperty(key(prefix,"minIdle"), "10")));
    cfg.setNumTestsPerEvictionRun(Integer.valueOf(props.getProperty(key(prefix,"numTestsPerEvictionRun"), "10")));
    cfg.setLifo(Boolean.valueOf(props.getProperty(key(prefix,"lifo"), "false")));
    cfg.setSoftMinEvictableIdleTimeMillis(Integer.valueOf((String)props.getOrDefault(key(prefix,"softMinEvictableIdleTimeMillis"), "10")));
    cfg.setTestOnBorrow(Boolean.valueOf(props.getProperty(key(prefix,"testOnBorrow"), "true")));
    cfg.setTestOnReturn(Boolean.valueOf(props.getProperty(key(prefix,"testOnReturn"), "false")));
    cfg.setTestWhileIdle(Boolean.valueOf(props.getProperty(key(prefix,"testWhileIdle"), "true")));
    cfg.setTimeBetweenEvictionRunsMillis(Integer.valueOf(props.getProperty(key(prefix,"timeBetweenEvictionRunsMillis"), "300000")));
    cfg.setBlockWhenExhausted(Boolean.valueOf(props.getProperty(key(prefix,"blockWhenExhausted"), "false")));
    return cfg;
}
 
Example 2
Source File: RedisUtils.java    From J2Cache with Apache License 2.0 6 votes vote down vote up
/**
 * 初始化 Redis 连接池
 * @param props j2cache.properties
 * @param prefix configuration prefix
 * @return redis connection pool configuration object
 */
public final static JedisPoolConfig newPoolConfig(Properties props, String prefix) {
    JedisPoolConfig cfg = new JedisPoolConfig();
    cfg.setMaxTotal(Integer.valueOf(props.getProperty(key(prefix,"maxTotal"), "-1")));
    cfg.setMaxIdle(Integer.valueOf(props.getProperty(key(prefix,"maxIdle"), "100")));
    cfg.setMaxWaitMillis(Integer.valueOf(props.getProperty(key(prefix,"maxWaitMillis"), "100")));
    cfg.setMinEvictableIdleTimeMillis(Integer.valueOf(props.getProperty(key(prefix,"minEvictableIdleTimeMillis"), "864000000")));
    cfg.setMinIdle(Integer.valueOf(props.getProperty(key(prefix,"minIdle"), "10")));
    cfg.setNumTestsPerEvictionRun(Integer.valueOf(props.getProperty(key(prefix,"numTestsPerEvictionRun"), "10")));
    cfg.setLifo(Boolean.valueOf(props.getProperty(key(prefix,"lifo"), "false")));
    cfg.setSoftMinEvictableIdleTimeMillis(Integer.valueOf((String)props.getOrDefault(key(prefix,"softMinEvictableIdleTimeMillis"), "10")));
    cfg.setTestOnBorrow(Boolean.valueOf(props.getProperty(key(prefix,"testOnBorrow"), "true")));
    cfg.setTestOnReturn(Boolean.valueOf(props.getProperty(key(prefix,"testOnReturn"), "false")));
    cfg.setTestWhileIdle(Boolean.valueOf(props.getProperty(key(prefix,"testWhileIdle"), "true")));
    cfg.setTimeBetweenEvictionRunsMillis(Integer.valueOf(props.getProperty(key(prefix,"timeBetweenEvictionRunsMillis"), "300000")));
    cfg.setBlockWhenExhausted(Boolean.valueOf(props.getProperty(key(prefix,"blockWhenExhausted"), "false")));
    return cfg;
}
 
Example 3
Source File: DefaultRedis.java    From craft-atom with MIT License 6 votes vote down vote up
private JedisPoolConfig convert(RedisPoolConfig cfg) {
	JedisPoolConfig jpc = new JedisPoolConfig();
	jpc.setBlockWhenExhausted(cfg.isBlockWhenExhausted());
	jpc.setLifo(cfg.isLifo());
	jpc.setMaxIdle(cfg.getMaxIdle());
	jpc.setMaxTotal(cfg.getMaxTotal());
	jpc.setMaxWaitMillis(cfg.getMaxWaitMillis());
	jpc.setMinEvictableIdleTimeMillis(cfg.getMinEvictableIdleTimeMillis());
	jpc.setMinIdle(cfg.getMinIdle());
	jpc.setNumTestsPerEvictionRun(cfg.getNumTestsPerEvictionRun());
	jpc.setTestOnBorrow(cfg.isTestOnBorrow());
	jpc.setTestOnReturn(cfg.isTestOnReturn());
	jpc.setTestWhileIdle(cfg.isTestWhileIdle());
	jpc.setTimeBetweenEvictionRunsMillis(cfg.getTimeBetweenEvictionRunsMillis());
	return jpc;
}