Created
November 27, 2014 12:55
-
-
Save bcambel/4a3bfa9954b4e3a641a7 to your computer and use it in GitHub Desktop.
Delete redis keys with the given pattern
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import redis | |
| import sys | |
| r = redis.StrictRedis('localhost',6379) | |
| def delete(pattern='kpn*'): | |
| print [r.delete(k) for k in r.keys(pattern)] | |
| if __name__ == "__main__": | |
| pattern = sys.argv[1] if len(sys.argv)>1 else "kpn*" | |
| delete(pattern) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment