问题描述
redis可以查找指定pattern的keys:
redis-cli -h [host] -p [port] -n [db] KEYS 'pattern'
但删除操作怎样删除特定pattern的keys?
问题解答
回答1:Redis下批量删除特定pattern的keys
redis-cli -h [host] -p [port] -n [db] KEYS 'pattern' | xargs redis-cli -h [host] -p [port] -n [db] DEL回答2:
How to atomically delete keys matching a pattern using Redis