Skip to content

Instantly share code, notes, and snippets.

@bcambel
Created November 27, 2014 12:55
Show Gist options
  • Select an option

  • Save bcambel/4a3bfa9954b4e3a641a7 to your computer and use it in GitHub Desktop.

Select an option

Save bcambel/4a3bfa9954b4e3a641a7 to your computer and use it in GitHub Desktop.
Delete redis keys with the given pattern
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