Certificates & Site Ops
Expiration math for tokens, signed URLs, and cache TTLs
A practical guide to expiry windows so tokens, signed URLs, and cached content stay valid for exactly as long as you intended.

Expiry bugs are rarely about the arithmetic being hard. They are about the contract being vague: which clock, which unit, what start time, and whose interpretation wins at the edges?
That makes expiration math a perfect topic for practical writing. The logic is straightforward once the inputs are named clearly.
In brief
What it is: Expiration math determines the validity window of a token, signed URL, or cached object based on an issue time, time-to-live, and validation policy.
Why it matters: Small mistakes in units, skew allowance, or start-time assumptions can create immediate expiry or unexpectedly long exposure.
Worth knowing: Define the starting event, unit, and clock assumptions whenever a value is described as “valid for one hour.”
Every expiry rule needs the same four answers
When does the window start? How long is it? Which clock decides? Is skew allowed? Those four questions explain most TTL and expiry behavior across JWTs, signed URLs, and caches. If even one answer is vague, the implementation starts to drift from the intended policy.
This is why a timestamp tool can be central to many security and caching workflows, not just a generic convenience feature.
Why tokens and cache TTLs feel similar but behave differently
A token may carry its own explicit expiry claim, while a cache entry may rely on headers or local metadata. Signed URLs may combine an issue time with a signature scope. The shared pattern is time-window control. The differences live in where the policy is stored and who enforces it.
- Document issue time and expiry time in one clear unit.
- Define skew tolerance instead of assuming it.
- Treat “one hour” as a formula, not as a vibe.
Choose a validity window people can operate reliably
A validity window that is too short for the real network path or user flow often leads teams to disable checks or add sloppy bypasses. Good expiry design is strict enough to matter and calm enough to operate.
See it in a small example
Notice: The formula is simple. The argument is usually about what issued_at, ttl, now, and allowed_skew actually mean in your system.
expires_at = issued_at + ttl
accept_if(now <= expires_at + allowed_skew)
What to verify
- Name the issue time, TTL, and skew policy explicitly.
- Use one unit end to end.
- Test the edges: just before expiry, exactly at expiry, and just after expiry.
Common questions
Does a shorter TTL always improve security?
A shorter window helps only when the real use case can complete within it; otherwise it tends to create operational workarounds.
Should caches and tokens use the same expiry strategy?
They share time-window logic, while their enforcement and storage models differ.