promotion/check_redis.py
2019-09-10 14:29:09 +08:00

34 lines
859 B
Python

# -*- coding: utf-8 -*-
from myredis.myredis import my_redis
def main():
all_keys = my_redis.keys()
ads_list = []
if all_keys:
for item in all_keys:
if len(item.split("::")) > 3:
print(f"find item = {item}! ")
try:
for one in my_redis.smembers(item):
ads_list.append(one)
except Exception:
print(f"{all_keys} get from redis via 'ad::[1004|2001]*' ")
else:
raise Exception("redis is nothing!")
print(f"redis ad list ={ads_list}")
for ad in ads_list:
name = f"ad::{ad}::info"
temp_data = my_redis.hgetall(name)
if temp_data:
pass
#print(temp_data)
else:
print(f"{name} ]\tnot found!")
if __name__ == "__main__":
main()