Re: [redis-db] HMSET to set expiration of key(s)

2,907 views
Skip to first unread message

Itamar Haber

unread,
Jan 31, 2017, 4:42:35 PM1/31/17
to Redis DB
Hello Seum-Lin,

While member/element expiration is a feature that has been requested several times in the past, it was not added to Redis mainly due to the complexities it would introduce. At the moment, expiration is only supported at key level.

There are, however, ways to implement "manual" expiration and the modules API opens the way to even more useful stuff - perhaps sharing your use case would illicit helpful advice from the forum's dwellers.

Cheers,
Itamar


On Jan 31, 2017 11:00 PM, "Seum-Lim Gan" <g...@media.mit.edu> wrote:
Hi,

Currently SET can set the expiration:
SET key value [EX seconds] [PX milliseconds] [NX|XX]

Can HMSET support setting the expiration like this ?
HMSET key field value [field value ...] [EX seconds] [PX milliseconds]

Thanks.
Gan

--
You received this message because you are subscribed to the Google Groups "Redis DB" group.
To unsubscribe from this group and stop receiving emails from it, send an email to redis-db+unsubscribe@googlegroups.com.
To post to this group, send email to redi...@googlegroups.com.
Visit this group at https://groups.google.com/group/redis-db.
For more options, visit https://groups.google.com/d/optout.

Marc Gravell

unread,
Jan 31, 2017, 6:19:51 PM1/31/17
to redi...@googlegroups.com
to point out the obvious: EX is a perfectly valid field name, so the command eould be ambiguous and woulr changr behavior.

but more generally: is your expectation that this expiration applies to the key? Or to the field? Field level  expiry is not supported. And for keys, the same operation can already be achieved by existing operations - perhaps in a multi/exec or Lua script if you like.

Seum-Lim Gan

unread,
Feb 6, 2017, 9:02:55 AM2/6/17
to Redis DB
Thanks Itamar !


This is from one of the users of Redis.

We asked him to pipe line the two requests into one but this is what he said:

"We use asynchronous mode to access redis from our application so we don’t wait for response for the first operation before issuing the second one, so it is inherently pipelined. But our problem is 2 operation which we want to be clubbed into 1."

I have asked him to join the forum directly so he can present, if any, his use case reason and any other reason he may have.

Thanks

Gan

On Tuesday, January 31, 2017 at 3:42:35 PM UTC-6, Itamar Haber wrote:
Hello Seum-Lim,

While member/element expiration is a feature that has been requested several times in the past, it was not added to Redis mainly due to the complexities it would introduce. At the moment, expiration is only supported at key level.

There are, however, ways to implement "manual" expiration and the modules API opens the way to even more useful stuff - perhaps sharing your use case would illicit helpful advice from the forum's dwellers.

Cheers,
Itamar


On Jan 31, 2017 11:00 PM, "Seum-Lim Gan" <g...@media.mit.edu> wrote:
Hi,

Currently SET can set the expiration:
SET key value [EX seconds] [PX milliseconds] [NX|XX]

Can HMSET support setting the expiration like this ?
HMSET key field value [field value ...] [EX seconds] [PX milliseconds]

Thanks.
Gan

--
You received this message because you are subscribed to the Google Groups "Redis DB" group.
To unsubscribe from this group and stop receiving emails from it, send an email to redis-db+u...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages