lua-resty-redis
lua-resty-redis copied to clipboard
Set key by expiration time
How can I set a record in Redis by the expiration time?
Any update regarding this topic?
You can use redisInstance.setex(key, ttl, value).
I'm used to a library where i can set with ttl as param, totally forgot 💃
You close this issue.
red:set() red:expire()
With red:expire(10) the key was still set to -1 (infinite) in the database.
setting red:expire(key,ttl) works for me and it is setting valid ttl in the redis databse.
^ yup, can confirm that red:expire(key, ttl) works!