Thank you for the quick reply, Jonathan.
We are using Jedis Pool with the following properties:
redis.timeout = 300000
jedis.pool.config.test.while.idle = true
jedis.pool.config.min.eviction.idle.time.millis = 600000
jedis.pool.config.time.between.eviction.runs.millis = 300000
Here's an example of how we use it:
public Long incrBy(Object key, Long count) {
if (key == null)
throw new IllegalArgumentException("Key must be non-null");
boolean broken = false;
Jedis jedis = null;
try {
jedis = jedisPool.getResource();
return jedis.incrBy(key.toString(), count);
} catch (JedisException jedisException) {
if (jedisException instanceof JedisConnectionException) broken =
true;
throw jedisException;
} finally {
if (jedis != null) {
if (broken) {
jedisPool.returnBrokenResource(jedis);
} else {
jedisPool.returnResource(jedis);
}
}
}
}
Thanks!