In redis, how do i remove keys?
问题 I want to remove keys that match "user*". how do I do that in redis command line? 回答1: This is not a feature right now to be able to do in one shot (see the comments in the DEL documentation). Unfortunately, you are only left with using KEYS , looping through the results, and then using DEL to remove each one. How about using bash a bit to help? for key in `echo 'KEYS user*' | redis-cli | awk '{print $1}'` do echo DEL $key done | redis-cli To step through it: echo 'KEYS user*' | redis-cli |