摘要:
今天发现Jedis 默认的连接方式 jedis=new Jedis(‘‘localhost‘‘,6379),老是发生connection timeout. 后来发现jedis类包还有一种可以设置最大连接时间的方法。 1->获取Jedis实例需要从JedisPool中获取; 2->用完Jedis实例需要还给JedisPool; 3->如果Jedis在使用过程中出错,则也需要还给JedisPool; 代码如下 JedisPoolConfig config = new JedisPoolConfig(); config.setMaxActive(100); config.setMa 阅读全文