redis - 根据regex 正则 删掉多个key

访问量: 327

参考:  https://stackoverflow.com/questions/4006324/how-to-atomically-delete-keys-matching-a-pattern-using-redis

通过 $ redis-cli INFO 来查看 server的版本. 

redis 2.6.0: 

EVAL "return redis.call('del', unpack(redis.call('keys', ARGV[1])))" 0 your_keys_pattern*

redis 3.2.8: 

redis-cli -n 1 keys your_keys* | xargs redis-cli DEL

对于 指定的端口号:

redis-cli -p 6800 keys *buy | xargs redis-cli -p 6800 DEL

订阅/RSS Feed

Subscribe

分类/category