Redis cli delete multiple keys

John FG picture John FG · Nov 18, 2016 · Viewed 16.1k times · Source

I have installed Redis in centos and I have multiple keys of redis like this,

Product:<id>:<url>

How can I delete all Product:*:* with CLI ?

Redis version : 3.2.4 [ Latest I guess ]

Thanks!

Answer

Itamar Haber picture Itamar Haber · Nov 18, 2016

Using the redis-cli tool, you can do the following:

redis-cli --scan --pattern 'Product:*:*' | xargs redis-cli DEL