Solution to connection timeout problem in jedis (jedispool connection pool usage instance)
•
Java
Today, I found that the default connection mode of jedis is jedis = new jedis ("localhost", 6379), and connection timeout always occurs Later, it was found that the jedis class package also has a method to set the maximum connection time.
1 - > get jedis instance from jedispool; 2 - > jedispool needs to be returned after using up jedis instances; 3 - > if jedis makes mistakes during use, it also needs to be returned to jedispool; The code is as follows
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
二维码