Skip to main content

EXPIREAT

Note

Official reference: EXPIREAT.

Set key expiration using a Unix timestamp in seconds.

Syntax

EXPIREAT key unix-seconds [NX | XX | GT | LT]

NX sets only absent expirations; XX changes existing expirations; GT/LT only extend/shorten them. An expiration at or before the current time deletes the key immediately.

Results

ReturnRowsContent
Update count--1 if timeout was set; 0 otherwise.

Example

SET demo:message hello
EXPIREAT demo:message 2000000000