Commit 7c056ad6 authored by 宋柯's avatar 宋柯

redis清理

parent d3dfa7f8
......@@ -272,25 +272,19 @@ for search_key in search_keys:
cursor, keys = conn.execute_command("scan {} match {} count {} {}".format(cursor,search_key,10,node))
node_key_count += len(keys)
cursor = str(cursor,encoding='utf-8')
pipline = conn.pipeline()
for key in keys:
key = str(key, encoding='utf-8')
idletime = conn.object('idletime', key)
if idletime > 2592000:
# print("key:{},idletime:{}".format(key,idletime))
node_del_key_set.add(key)
# if len(dd) > 0 and dd.startswith(key_k):
# del_datas.add(str(d, encoding='utf-8'))
pipline.object('idletime', key)
# idletime = conn.object('idletime', key)
# if idletime > 2592000:
# node_del_key_set.add(key)
idletime_list = pipline.execute()
print("idletime_list:{}".format(idletime_list))
# key_sum += len(del_datas)
# break
# pipline = conn.pipeline()
# for d in del_datas:
# ls = [str(s,encoding='utf-8') for s in conn2.lrange(d,0,-1)]
# conn.lpush(d,ls)
# conn.delete(d)
# # pipline.expire(d, 60 * 60 * 24 * 3)
# pipline.execute()
# if cursor == 0 or len(data) == 0:
if cursor == "0":
break
print("node: {}, cursor: {}, node_key_count: {}, node_del_key_count: {}".format(node, cursor, node_key_count, len(node_del_key_set)))
......
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