There are no
expiration_ttl, expiration, or metadata fields on a write, and no --ttl/--metadata CLI flags. Anything you put in the request body (including JSON that looks like those fields) is stored verbatim as the value, not interpreted.Expiring keys at the application level
To get expiry behavior, wrap your value with anexpires_at timestamp and check it when you read. If it’s in the past, treat the key as missing (and optionally delete it).
- Reads do the enforcing. An expired key still occupies storage until it’s read (and lazily deleted) or you delete it explicitly. Run a periodic sweep with cron triggers if you need eager cleanup.
- Use a consistent clock.
Date.now()on the edge node is fine for coarse expiry; don’t rely on it for sub-second precision. - Keep the envelope small. You pay for stored bytes, so the wrapper adds a little overhead per key.