Posted By: Anonymous
In my Redis DB I have a number of
Sometimes I want to purge them all atomically. How do I do this without using some distributed locking mechanism?
Starting with redis 2.6.0, you can run lua scripts, which execute atomically. I have never written one, but I think it would look something like this
EVAL "return redis.call('del', unpack(redis.call('keys', ARGV)))" 0 prefix:[YOUR_PREFIX e.g delete_me_*]
Warning: As the Redis document says, because of performance maters,
command should not use for regular operations in production, this
command is intended for debugging and special operations. read
See the EVAL documentation.