diff --git a/check_redis.py b/check_redis.py new file mode 100644 index 0000000..5da492a --- /dev/null +++ b/check_redis.py @@ -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() + diff --git a/handler/__pycache__/company.cpython-36.pyc b/handler/__pycache__/company.cpython-36.pyc index 2965e3b..d520f91 100644 Binary files a/handler/__pycache__/company.cpython-36.pyc and b/handler/__pycache__/company.cpython-36.pyc differ diff --git a/handler/__pycache__/location.cpython-36.pyc b/handler/__pycache__/location.cpython-36.pyc index 1b73a5b..4b5d424 100644 Binary files a/handler/__pycache__/location.cpython-36.pyc and b/handler/__pycache__/location.cpython-36.pyc differ diff --git a/myredis/__pycache__/myredis.cpython-36.pyc b/myredis/__pycache__/myredis.cpython-36.pyc index 2ff9c18..09bfe88 100644 Binary files a/myredis/__pycache__/myredis.cpython-36.pyc and b/myredis/__pycache__/myredis.cpython-36.pyc differ diff --git a/print_redis.py b/print_redis.py new file mode 100644 index 0000000..e5128a8 --- /dev/null +++ b/print_redis.py @@ -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() +