Redis Wildcard Delete

Redis supports a keys command, which takes in a pattern, but you can’t use patterns for deletes. Fortunately awk and xargs makes this easy.

Just throw this on your server (somewhere in the PATH), chmod 755, and you’re good to go.

redis-cli keys $1 | awk '{print $1}' | xargs --interactive redis-cli del {} \;

How to use:

redis-del pattern*