1
This commit is contained in:
parent
5349c6b9f2
commit
851129ab1f
@ -1,5 +1,5 @@
|
||||
[
|
||||
{
|
||||
"key_prefix": ""
|
||||
"key_prefix": "game2004"
|
||||
}
|
||||
]
|
||||
|
@ -37,7 +37,6 @@ def scanKeys(r, key_prefix, matched_keys):
|
||||
#end while cursor
|
||||
|
||||
def saveKeys(r, keys, curr_file):
|
||||
print(keys)
|
||||
for key in keys:
|
||||
data = r.get(key)
|
||||
curr_file.write(json.dumps({'key': key, 'data':data}) + '\n')
|
||||
@ -48,13 +47,13 @@ def exportRedis(context, redis_conf, redis_rule_conf):
|
||||
r = redis.Redis(host = conf['host'],
|
||||
port = conf['port'],
|
||||
password = conf['passwd'],
|
||||
charset = 'utf8'
|
||||
decode_responses = True
|
||||
)
|
||||
print(r)
|
||||
for rule in redis_rule_conf:
|
||||
matched_keys = {}
|
||||
scanKeys(r, rule['key_prefix'], matched_keys)
|
||||
saveKeys(r, curr_file, matched_keys)
|
||||
saveKeys(r, matched_keys, curr_file)
|
||||
#end for conf
|
||||
|
||||
def main():
|
||||
|
Loading…
x
Reference in New Issue
Block a user