Generic
EXPIRE
Sets a timeout on key. The key will automatically be deleted.
await redis.set("mykey", "Hello");
await redis.expire("mykey", 10);
Arguments
key
string
requiredThe key to set the timeout on.
seconds
integer
How many seconds until the key should be deleted.
Response
1
if the timeout was set, 0
otherwise
await redis.set("mykey", "Hello");
await redis.expire("mykey", 10);