I am trying to force my redis client to timeout for testing purpose and I a fail to achieve so. I specify timeout to 2ms in my config and the set operation I perform takes > 2ms so why it does not timeout? Are these settings are kind of soft settings and not hard enforcement? I am using Jedis 2.6 and Scala 2.10 with Play 2.2.3
@Singleton
class RedisClient extends Cache {
// set timeout
val TIMEOUT = 2
private val pool = new JedisPool(new JedisPoolConfig(), getStringFromConfig("redis.url"), getIntFromConfig("redis.port"), TIMEOUT);
def isOpen = pool.getNumActive()
def set(key: String, value: String) = {
isOpen match {
case -1 => throw new Exception("Redis server is not running")
case _ => {
val jedis = pool.getResource()
val before = Platform.currentTime
jedis.set(key, value)
println("TIME TAKEN " + (Platform.currentTime - before))
pool.returnResource(jedis)
}
}
}
}