Created
December 14, 2014 18:57
-
-
Save bcambel/67ecb33d1b8dc39d538d to your computer and use it in GitHub Desktop.
Delete REDIS keys by a 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='a*'): | |
| print [r.delete(k) for k in r.keys(pattern)] | |
| if __name__ == "__main__": | |
| pattern = sys.argv[1] if len(sys.argv)>1 else "a*" | |
| delete(pattern) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment