python 关闭redis的连接

在python语言中使用redis时,没有找到对应的关闭的方法

 

try:
self.redisconn = StrictRedisCluster(startup_nodes=self.redisNodes)
except Exception as e:
pass

关闭的时候其实可以使用:
self.redisconn.connection_pool.disconnect()

ConnectionPool.disconnect() does in fact close all the connections opened from that connection pool

虽然这里并没有使用到连接池,但这样的使用仍然有效


posted on 2019-05-22 10:24  yingchen  阅读(3203)  评论(0编辑  收藏  举报

导航