Expiration
Last updated
This page explains how ToriiDB keys get a TTL and the points at which expired keys are removed.
Expiration
| Operation | Result |
|---|---|
TTL(key) |
remaining seconds; -1 without expiry; -2 when missing or expired |
Expire(key, seconds) |
ExpireAt = now + seconds |
ExpireAt(key, ts) |
absolute timestamp |
Persist(key) |
removes expiry |
Expired keys are enforced at several points:
Gettreats an expired entry as missing and deletes it from memory.Keys,Find,Query, andVSearchskip expired entries.- A timer removes expired entries from every loaded database once per minute.
- Compaction does not write expired entries to the new snapshot.