import redis
class RedisTool:
r = None
def __init__(self):
self.r = redis.ConnectionPool(password=123,max_connections=10)
@property
def useredis(self):
a = redis.Redis(connection_pool=self.r,decode_responses=True)
return a
if __name__ == '__main__':
p = RedisTool()
p.useredis.set()