JedisConnectionPool scala

/**
  * Created by lq on 2017/8/29.
  */
object JedisConnectionPool {

  val config = new JedisPoolConfig()
  //最大连接数
  config.setMaxTotal(10)
  //最大空闲连接数
  config.setMaxIdle(5)
  //当调用borrow object 方法时,是否进行有效性验证
  config.setTestOnBorrow(true)
  val pool = new JedisPool(config, "mini1", 6379)

  def getContion(): Jedis = {
    pool.getResource
  }
}

 

posted @ 2017-08-29 09:37  牵牛花  阅读(795)  评论(0编辑  收藏  举报