Redis/Jedis - Delete by pattern?

前端 未结 5 609
渐次进展
渐次进展 2021-02-04 11:38

Normally, I get the key set then use a look to delete each key/value pair.

Is it possible to just delete all keys via pattern?

ie:

Del sample_pat         


        
5条回答
  •  栀梦
    栀梦 (楼主)
    2021-02-04 12:11

    You can do it with bash:

    $ redis-cli KEYS "sample_pattern:*" | xargs redis-cli DEL
    

提交回复
热议问题