class RedisOperate:
def __init__(self, **kwargs):
redis_pool = redis.ConnectionPool(
host=kwargs.get("host"),
port=6379,
password=kwargs.get("password"),
db=0,
decode_responses=True)
self.redis_conn = redis.Redis(connection_pool=redis_pool)
def get(self, key):
value = self.redis_conn.get(key)
print("查询到的value为{}".format(value))
return value
def delete(self, key):
self.redis_conn.delete(key)
self.get(key)
def set(self, key, value):
self.redis_conn.set(key, value)
self.get(key)
if __name__ == '__main__':
ro = RedisOperate(**{"host": "10.182.40.139", "password": "5p1ZDc0MjQxZT#A"})
ro.delete("ota-bss:package:report:final:cal:1770VINSHOUDONG092010")
redis操作的封装
最新推荐文章于 2024-11-13 13:53:13 发布