add check ads redis
This commit is contained in:
parent
9b239e42e2
commit
7accb6d877
35
check_redis.py
Normal file
35
check_redis.py
Normal file
@ -0,0 +1,35 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from myredis.myredis import my_redis
|
||||
|
||||
|
||||
def main():
|
||||
# key = '1066'
|
||||
# ad::2001::6001::1::1063 ad::{\d+}::{\d+}::{\d}::{\d+}
|
||||
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()
|
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
24
print_redis.py
Normal file
24
print_redis.py
Normal file
@ -0,0 +1,24 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from myredis.myredis import my_redis
|
||||
|
||||
def main():
|
||||
key = '1066'
|
||||
all_keys = my_redis.keys(pattern=f'*::{key}')
|
||||
ads_list = []
|
||||
if all_keys:
|
||||
for item in all_keys:
|
||||
try:
|
||||
for one in my_redis.smembers(item):
|
||||
ads_list.append(one)
|
||||
except Exception:
|
||||
print(f"{all_keys} get from redis via '*::{key}' ")
|
||||
|
||||
for ad in ads_list:
|
||||
name = f"ad::{ad}::info"
|
||||
temp_data = my_redis.hgetall(name)
|
||||
print(temp_data)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
|
Loading…
x
Reference in New Issue
Block a user