DELETE Reids KEYS
#!/usr/bin/env python3 | |
# -*- coding:utf-8 -*- | |
import sys | |
import redis | |
HOST_NAME = "" | |
DB_NUMBER = 0 | |
if __name__ == "__main__": | |
args = sys.argv | |
conn = redis.StrictRedis(host=HOST_NAME, db=DB_NUMBER) | |
xs = [] | |
for idx, key in enumerate(conn.scan_iter(match=args[1], count=1000)): | |
xs.append(key) | |
if idx % 100 == 0: | |
conn.delete(*xs) | |
print(f"{idx}:{key}") | |
xs.clear() | |
conn.delete(*xs) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment