代码语言:javascript复制
EVAL "return redis.call('del', 'defaultKey', unpack(redis.call('keys', ARGV[1])))" 0 prefix:*
循环删除:
代码语言:javascript复制EVAL "local keys = redis.call('keys', ARGV[1]) n for i=1,#keys,5000 do n redis.call('del', unpack(keys, i, math.min(i 4999, #keys))) n end n return keys" 0 prefix:*
References
- How to atomically delete keys matching a pattern using Redis | stackoverflow
– EOF –
- # redis