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 @   牵牛花  阅读(796)  评论(0编辑  收藏  举报
努力加载评论中...
点击右上角即可分享
微信分享提示