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

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


原文地址:https://www.cnblogs.com/yingchen/p/10904328.html