We have a list of hundreds of thousands of Redis keys containing all sorts of special characters and we would like to bulk delete them. There are some great answers to a similar problem on this question: How to atomically delete keys matching a pattern using Redis
HOWEVER, I can't seem to find an answer for the case where:
- We have a large number of keys (hundreds of thousands)
- The keys have all manners of special characters like double quotes ("), backslashes (), all sorts of weird Unicode characters, etc.
- We are using the windows redis-cli client
- Bonus: Ideally we would be able to issue this command as part of a MULTI/EXEC transaction so we can also delete a SET atomically along with the keys.
I would LOVE if we could just do something like the below, but have it handle keys with all of the special characters that give Redis problems:
redis-cli SMEMBERS "myGiganticListOfKeys" | xargs --delim='\n' redis-cli DEL
Unfortunately this just gives the below error:
"C:/Program Files (x86)/Git/bin/xargs.exe": redis-cli: Bad file number
I think this would otherwise work if we didn't have special characters in the keys.
Thanks so much in advance.