Surely by now people have realised that deleting multiple keys at once (something like del key:*) is incredibly useful, especially for devs like me that have to hunt down the same verbose LUA script every single time I want to delete a handful of keys while testing.

Is deleting multiple keys a feature that can be added? Redis has been around for a long enough time now, and I haven't seen anything on this when I've checked other than "it isn't possible".

Comment From: alimousazy

I can work on this, do you mean delete with hash keys ?

Comment From: alimousazy

https://redis.io/commands/hdel

Comment From: alimousazy

what about if the user want to use key:* as a key, how this should work ?

Comment From: alimousazy

maybe you can delete the hash entirely if you want to delete all the keys

Comment From: mgravell

Frankly, if you have a bunch of related keys that commonly need to die together, I wonder if you should simply use a hash anyway. Then a single del kills all of them and it avoids sharing issues on cluster etc. You can still read/write/remove single items via hset / hget / hdel.

Del is already varadic but you need to know the keys you want to delete. "del x y z" works fine. I doubt a "dellike foo*" would ever be added due to both the sharding (cluster) issue, and the performance impact (see: "keys" command).

Comment From: hbq0449

I am working on redis cluster, and need the solution for the same issue. My data is about 10G, and need weekly renew, which means some data will be removed, some will be update, some will add, they need to be associated together. So I need to fist add data to redis cluster, then switch the access to the new data set, then remove the old ones.

If i store it in a hash, they will stored in a single node or they will be stored on multiple node. If they store on a single node, will it slow down the access performance of the cluster?

the scan command can item through key pattern. can I use it to delete data? according to document. is is not guaranteed to return all the key, but on stackoverflow, there is a lot of answers use scan to del data.

Comment From: Asalle

what about if the user want to use key:* as a key, how this should work ?

escape it

Comment From: tobiasBora

@mgravell The hash works nicely if you are not already using a hash. But since you cannot nest hashes, it's not always applicable.