How does the hmset in redis set the timeout for a key?

I recorded the token, timeout when I logged in, as shown in the following figure:

clipboard.png

is there any way to set the expiration time for one of these key,? Or delete the data automatically when it expires? If you can"t set the expiration time, do you just have to run a fixed-time task? Please give me some advice if you know. Thank you

Apr.05,2021

EXPIRE key seconds

you can set expiration to any redis data type


redis can only set expiration time for the most advanced key. Unable to set expiration time for individual key in Hashley. If it's just a log log token. You can just use setex (key=token:uid)

Menu