32 lines
737 B
Python
32 lines
737 B
Python
# pip3 install redis
|
|
|
|
import redis
|
|
import json
|
|
from concurrent.futures import ThreadPoolExecutor
|
|
|
|
res = None
|
|
|
|
def connect():
|
|
res = redis.StrictRedis(host='172.22.0.8', port=6379, db=0, password='pc8DphhaXwTe2jyv')
|
|
return res
|
|
|
|
|
|
def handle_keys():
|
|
try:
|
|
members = res.zrange('peko:seize_treasure:rank:value:2023-10-24', 0, -1, withscores=True)
|
|
for m in members:
|
|
uid = m[0].decode('utf-8')
|
|
score = m[1]
|
|
print(uid, ',', score)
|
|
except Exception as e:
|
|
print("handle_keys error.", e)
|
|
|
|
|
|
if __name__ == '__main__':
|
|
res = connect()
|
|
if res is None:
|
|
print("redis connect is error.")
|
|
else:
|
|
print("redis connect is success.")
|
|
handle_keys()
|