Commit 84555e16 authored by 张彦钊's avatar 张彦钊

add

parent 360673d4
...@@ -40,7 +40,7 @@ def diary_key(): ...@@ -40,7 +40,7 @@ def diary_key():
r = redis.StrictRedis.from_url('redis://:ReDis!GmTx*0aN6@172.16.40.133:6379') r = redis.StrictRedis.from_url('redis://:ReDis!GmTx*0aN6@172.16.40.133:6379')
cursor = 0 cursor = 0
while True: while True:
new_cursor,keys_list = r.scan(cursor,"TS:recommend_diary_set:device_id:*",2000) new_cursor,keys_list = r.scan(cursor,"TS:recommend_tractate_set:device_id:*",2000)
delete_keys = [] delete_keys = []
for i in keys_list: for i in keys_list:
if r.ttl(i) == -1: if r.ttl(i) == -1:
...@@ -54,6 +54,29 @@ def diary_key(): ...@@ -54,6 +54,29 @@ def diary_key():
break break
cursor = new_cursor cursor = new_cursor
def qa_key():
r = redis.StrictRedis.from_url('redis://:ReDis!GmTx*0aN6@172.16.40.133:6379')
cursor = 0
while True:
new_cursor,keys_list = r.scan(cursor,"TS:recommend_answer_set:device_id:*",2000)
delete_keys = []
for i in keys_list:
if r.ttl(i) == -1:
delete_keys.append(i)
if len(delete_keys) > 0:
r.delete(*delete_keys)
print("总数量")
print(len(keys_list))
print("删除帖子数量")
print(len(delete_keys))
# 循环一遍后结束
if new_cursor == 0:
break
cursor = new_cursor
def topic_key(): def topic_key():
r = redis.StrictRedis.from_url('redis://:ReDis!GmTx*0aN6@172.16.40.133:6379') r = redis.StrictRedis.from_url('redis://:ReDis!GmTx*0aN6@172.16.40.133:6379')
cursor = 0 cursor = 0
...@@ -76,6 +99,24 @@ def topic_key(): ...@@ -76,6 +99,24 @@ def topic_key():
break break
cursor = new_cursor cursor = new_cursor
def serach():
r = redis.StrictRedis.from_url('redis://:ReDis!GmTx*0aN6@172.16.40.133:6379')
cursor = 0
while True:
new_cursor,keys_list = r.scan(cursor,"*",10000)
delete_keys = []
for i in keys_list:
if r.ttl(i) == -1:
delete_keys.append(i)
if len(delete_keys) == 100:
print(delete_keys)
break
# 循环一遍后结束
if new_cursor == 0:
break
cursor = new_cursor
if __name__ == "__main__": if __name__ == "__main__":
topic_key() topic_key()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment