Hi, I'm using a redis-sentinel k8s statefulset and I have a use case where I need to delete a massive amount of keys. For now we are using the the "del" command but I was wondering if it will be more efficient to just expire all the keys after 1 second (the delay doesn't bother me).
So, is it more efficient or should I just stick to the "del" command?
Thank you :)
Comment From: zuiderkwast
Hello,
you can use UNLINK. It is an asynchronous DEL and it does some of the job in a background thread, so it should be more efficient.
Expire the keys after 1 second should also work. In this case, the keys will be deleted over some time in a background task or lazily when they are accessed.
Comment From: zuiderkwast
See also the section "LAZY FREEING" in redis.conf: https://github.com/redis/redis/blob/unstable/redis.conf#L1213
Comment From: nadavtsa
Great! Thank you for the quick reply :)