It would be useful to have a HSETX/HMSETX which consolidates a hset+setex command onto the key. I am not talking about timeouts on the values, but including the expire for the key on the hash set action.
For example:
hsetx KEY FIELD VALUE TIMEOUT
would comparable to
hset KEY FIELD VALUE
setex KEY TIMEOUT
and
hsetx KEY FIELD VALUE FIELD VALUE TIMEOUT
would be comparable to
hset KEY FIELD VALUE FIELD VALUE FIELD VALUE
setex KEY TIMEOUT
while this can be handled with pipelining, consolidating the calls would be incredibly useful.
reference #441 reference #1465
Comment From: itamarhaber
@jvanasco why open a new issue if two existing ones were closed already?
Also, this is trivial to achieve with a Lua script or (if you must) a module.
Comment From: jvanasco
441 is a closed ticket looking to implement an atomic modification to simplify a transaction that included a preliminary EXIST.
1465 is still open but written in a foreign language and translated. the intent was unclear, and could either mean the previously rejected request for setex on independent fields OR simply applying setex to hashes (which works)
I couldn't find any tickets, open or closed, that referenced this specific behavior.
Comment From: mpermar
Bearing in mind that a key for a hash is exactly the same as a key for any other redis element I find inconsistent and error-prone (in terms of races) that you can set key expires on SET but not on HSET. I understand it can be done with Lua scripts, but if it is already done with any other regular keys I don't understand why keys for a hash object need to be different.
Comment From: itamarhaber
Just noticed that this is a duplicate of #2905
Comment From: itamarhaber
Closing this as dup - feel free to reopen or create a new issue if needed.