redis remove all keys by pattern code example
Example: redis delete keys that match pattern
redis-cli --scan --pattern users:* | xargs redis-cli del
# Or if you have a cluster:
redis-cli --scan --pattern users:* | xargs -L redis-cli -c del
redis-cli --scan --pattern users:* | xargs redis-cli del
# Or if you have a cluster:
redis-cli --scan --pattern users:* | xargs -L redis-cli -c del