The problem/use-case that the feature addresses

Currently, the EXISTS command will return the number of existing keys but cannot tell which keys exist.

Description of the feature

I would like to add a new MEXISTS command to resolve this scenario. The behavior will be like below:

redis-cli > SET a 1
OK
redis-cli > SET b 2
OK
redis-cli > MEXISTS a b c d
1) 1
2) 1
3) 0
4) 0

I see https://github.com/redis/redis/issues/7149 also mentioned this.

My question is that sound good to add this command? if yes, then I will submit a PR.

Comment From: enjoy-binbin

sound good to me, this seem useful. @oranagra i see you add it to next minor backlog, WDYT?

Comment From: oranagra

i'm not sure. we generally try to avoid adding multi-key commands, and in some cases even variadic commands that work on multiple elements on a single key. we need to consider this. i added it to the milestone so that it'll be on our radar later on.

Comment From: git-hulk

Thanks @enjoy-binbin and @oranagra, we need a way to check the multiple keys existing without retrieving the huge value. Maybe we can use Lua script to work around this, but it'd be perfect if can support this command.

Comment From: oranagra

@git-hulk what's the downside of a MULTI-EXEC sequence?

Comment From: git-hulk

@oranagra The downside is the overhead of the CPU since Redis must parse more commands instead of at once. I'm good with MULTI-EXEC but it'd be better if we can achieve this more simply.

Comment From: oranagra

i think the performance overhead is very low, and isn't a real concern. what i was expecting is a complaint about some complications from using MULTI, which makes it complicated, either due to client library issues, or something like #9926

Comment From: git-hulk

what i was expecting is a complaint about some complications from using MULTI, which makes it complicated, either due to client library issues, or something like #9926

Yes, we didn't compare the performance between MEXISTS and MULTI, so I'm not sure how much this will be affected.

Comment From: xuliang0317

i'm not sure. we generally try to avoid adding multi-key commands, and in some cases even variadic commands that work on multiple elements on a single key. we need to consider this. i added it to the milestone so that it'll be on our radar later on.

I agree .if the multi-key commands including a lot of keys,It runs for a long time and is difficult to interrupt on the client side. If you use command about multi-key, you can encapsulate them based on the single key command for your own use.

Comment From: git-hulk

@xuliang0317 I believe you cannot interrupt as well if you're using the pipeline or Lua script to achieve this. What you need to do is avoid too many keys in one request and nothing to do with whether a command should support multiple keys or not. :)