jedis使用-pool池(2,9版本)

发布时间:2020-08-26 01:47:25 作者:panguixiang
来源:网络 阅读:978

首先创建线程池:
public voidRedisPool() {
if(Const.jedisPoolCommon==null){
JedisPoolConfig config = new JedisPoolConfig();
//最大连接数, 默认8个
config.setMaxTotal(redisPoolMaxActive);
//最大空闲连接数, 默认8个
config.setMaxIdle(redisPoolMaxIdle);
//获取连接时的最大等待毫秒数
config.setMaxWaitMillis(100000);
//最小空闲连接数, 默认0
config.setMinIdle(redisPoolMinIdle);
//连接耗尽时是否阻塞, false报异常,ture阻塞直到超时, 默认true
config.setBlockWhenExhausted(true);
config.setTestOnBorrow(TEST_ON_BORROW);
Const.jedisPoolCommon = new JedisPool(config,host,port,timeout,password);
}
}

工具使用池:
/**

推荐阅读:
  1. multiprocessing Pool 进程池
  2. Python进程池Pool的示例分析

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

jedis edi

上一篇:vue开发移动端底部导航条功能

下一篇:Java Swing JFrame窗口的实现

相关阅读

您好,登录后才能下订单哦!

密码登录
登录注册
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》