Redis [Snippet] : Delete multiple key with same prefix

After I install redis-tools, and using ./redis-load some test keys is still exist, test keys is like this,  string:12312. But the count of keys is more than 4000, and it’s bothering me. So after some googling i found this on stackoverflow. And it works for me. Here is the code :

redis-cli KEYS "string:*" | xargs redis-cli DEL

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s