Redis already supports MSET and MSETNX, however if you'd like to set several in one operation with a shared expiry, you are currently left with having to resolve to Lua which is hard to do right on RedisCluster.

I think this is a rather common use case, especially for libraries that batch up cache changes and send them in bulk by design. And with separate command for this it will be more natural for redis clients to follow suite and add support for it also when using Redis Cluster.

If this is not considered, then maybe EVAL needs to be better specified on how it is intended to behave if some of the keys are for different nodes (e.g. eval should be splitted to perform script in batch per node with keys relevant for each node + definition of return value handling, so redis clients can be adjusted to take this into account)

This is duplicate of (closed) issue #4445 "redis can support msetex or msetpx command?"

Comment From: freak4pc

Was there ever any progress with this?

Right now it's either using SETEX for multiple key/value(s), or use MSET and use EXPIRE on multiple keys by hand. Not sure which is "worse".

Comment From: andrerom

@enjoy-binbin Something to consider for 7.2 or 7.2+1? Would greatly benefit/simplify use and latency on bulk cache saving work against cluster.

Comment From: enjoy-binbin

It seems like a nice feature, and i see a lot of thumbs up. @oranagra WDYT?

Comment From: oranagra

unlike variadic commands that deal with multiple fields of the same key, we usually try to resist variadic commands that deal with multiple keys, maybe this one could be an exception though, since (in theory, but not in practice) it's just about adding an extra TTL argument to an existing command. @itamarhaber any other thoughts?

for the question of what's better: an using a pipeline of SETEX, possibly even inside a MULTI-EXEC seems as efficient as an MSETEX (which make we wonder if we really need such command). using MSET and EXPIRE can be less efficient since it can lookup the same key in the dict twice.