Generic

EXPIRE

Sets a timeout on key. The key will automatically be deleted.

Arguments

keybodystringrequired

The key to set the timeout on.

secondsbodyinteger

How many seconds until the key should be deleted.

Response

integerrequired

1 if the timeout was set, 0 otherwise

Example
await redis.set("mykey", "Hello");await redis.expire("mykey", 10);
Loading search…