Description
Set a timeout on a key. After the timeout has expired, the key will automatically be deleted.Method Signature
Parameters
The key to set expiration on
The number of seconds until the key expires
Optional modifier for the expiration behavior:
"NX"- Set expiry only when the key has no expiry"XX"- Set expiry only when the key has an existing expiry"GT"- Set expiry only when the new expiry is greater than current one"LT"- Set expiry only when the new expiry is less than current one
"nx", "xx", "gt", "lt")Return Value
1if the timeout was set0if the timeout was not set (key doesn’t exist or condition not met)