I wouldn't be surprised if this is already planned, but I propose adding new commands that logically extend from string command SET-plus-EXPIRE variants:

HSETEX key, ttl, field, value HMSETEX key, ttl, field, value [field, value ...]

These commands would do the same as HSET and HMSET, but also perform EXPIRE in the same way that SETEX does for string keys.

Of course, similar commands for sets, sorted sets etc. would make sense too.

Comment From: nnog

Just to pre-emptively answer the "Why not just use Lua/multi/pipelining to do this?"... These commands aren't crucial, but they would simply save on cmd buffer size, command processing overhead, and the additional hash lookup, to the same degree for which SETEX was deemed to be of benefit.

Comment From: jvanasco

It would make more sense to extend HSET/HMSET with the timestamps -- SET now supports the SETEX functionality, and SETEX is being sunsetted.

It would also make sense to have the inverse as a 'get' function that returns the value and ttl with a single lookup [see my request for GET functionality here: https://github.com/antirez/redis/issues/2872 ]

Comment From: Epokhe

Do we have any plans to implement this?

Comment From: kannanmavila

This would be nice to have.

Comment From: tony-is-coding

dreaming!!!!!

Comment From: masoodkamyab

Is this implemented after 5 years:question:

Comment From: itamarhaber

@masoodkamyab not every feature request gets implemented. This one, for example, isn't.

Comment From: jvanasco

@itamarhaber perhaps there should be a "rejected" or "wontfix" label for tickets such as this?

Comment From: itamarhaber

@jvanasco perhaps, but that's up to the maintainers of the repo :)

Comment From: jvanasco

@itamarhaber ha! i thought that included you. sorry!

Comment From: dinukaamarasinghe817

Is this being implemented after 9 years?