TTL, EXPIRE, EXPIREAT, and PERSIST
Last updated
This page covers the ToriiDB commands that read, set, and remove a key's expiry.
Expiration
- TTL <key>
- EXPIRE <key> <seconds>
- EXPIREAT <key> <timestamp>
- PERSIST <key>
| Command | Response rules |
|---|---|
TTL | (integer) -1 without expiry; (nil) when missing or expired |
EXPIRE | error: seconds must be a positive integer for <= 0 or non-integer; (nil) when missing |
EXPIREAT | error: timestamp must be a valid integer; (nil) when missing |
PERSIST | (nil) when missing |