redishashsetttl

How to put a TTL/expiration on an HSET


An HSET is like so:

HSET myhash field1 "Hello"

is there a way to put an expiration/TTL on the "field1" key. It's trivial to put an expiration on myhash tmk, but I don't know how to put a TTL on key of a hash.

https://redis.io/commands/expire

Otherwise, I am stuck using:

SET field1 "Hello"
EXPIRE field1 10

and putting all my keys at the top-level instead of a hash :(


Solution

  • See https://github.com/antirez/redis/issues/1042

    Currently it's not possible.