# -*- coding: utf-8 -*-
# Redis通用类
# 作者: 陈磊
# 时间: 2019-10-21

import redis
from WorkUtils.UtilsLog import UtilsLog


class UtilsRedis(object):
    def __init__(self, host):
        self.log = UtilsLog()
        self.log.info("调用基础Redis通用类")
        self.log.info(self.__class__)
        self.host = host

    def conn_redis(self, ):
        self.log.debug("连接Redis")
        pool = redis.ConnectionPool(host=self.host, port="6379")
        r = redis.Redis(connection_pool=pool)
        return r


if __name__ == '__main__':

    rt = UtilsRedis(host="192.168.1.180",).conn_redis()
    print(rt.get("checkCode_15151969022"))