Expire is only valid for the top-level key, and cannot be set for a file in the hash structure.
At the same time, currently redis does not provide a method such as hsetex(), so if you want to set expires on hash, you can use the following method:
- redis 127.0.0.1:6379> hset expire:me name tom
- (integer) 0
- redis 127.0.0.1:6379> hget expire:me name
- "tom"
- redis 127.0.0.1:6379> expire expire:me 10
- (integer) 1
- redis 127.0.0.1:6379> ttl expire:me
- (integer) 8