pyEfiRedis.py 文件源码

python
阅读 22 收藏 0 点赞 0 评论 0

项目:pyEfi 作者: lucid281 项目源码 文件源码
def __init__(self, type='sock',
                 hostOrSocket='/var/run/redis/redis.sock',
                 database=0, decode=True
                 ):
        """Setup redis connection here..."""
        try:
            if 'sock' is type:
                self.redisDb = redis.StrictRedis(unix_socket_path=hostOrSocket,
                                                 decode_responses=decode, db=database)
            elif 'ip' is type:
                self.redisDb = redis.StrictRedis(host=hostOrSocket, port=6379,
                                                 decode_responses=decode, db=database)
            else:
                ttyP(7, "redis conf did not work. exiting...")
                exit(1)
        finally:
            # this always prints, helpful debugging
            endc = '\033[0m'
            ttyP(4, "  redis @ " + endc + hostOrSocket)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号