The Redis DEL command accepts multiple, space-separated keys for deletion (docs) like DEL key1 key2 key3, so there should be a way to do the same from a client library. I’m not sure which library you’re using, though? The thread is tagged with “redix” but that doesn’t include a RedisClient module.
From what you’ve written above, I might try something like:
Can you share the code implementing RedisClient.delete, or a link to the library this module comes from? It’s hard to guess whether your delete method might already be able to accept an Enumerable like list_of_all_keys directly, or why it isn’t safely passing a space-separated list through to Redis.
If you only have a few keys to delete then it might not make much of a difference, but with many keys it becomes a big deal.
FWIW, Redix uses the “RESP” format to communicate with Redis so joining arguments with spaces won’t do what you’d expect compared to the telnet interface:
Redix.command(@some_redis, ["DEL", "123 456"]) → asks to delete one key, 123 456
Redix.command(@some_redis, ["DEL", "123", "456"]) → asks to delete two keys, 123 and 456