Skip to content

Instantly share code, notes, and snippets.

@bcambel
Created December 14, 2014 18:57
Show Gist options
  • Select an option

  • Save bcambel/67ecb33d1b8dc39d538d to your computer and use it in GitHub Desktop.

Select an option

Save bcambel/67ecb33d1b8dc39d538d to your computer and use it in GitHub Desktop.
Delete REDIS keys by a given pattern
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