Skip to content

Correct the extreme-ttl doc claims about the sharded stores - #322

Merged
jaemk merged 2 commits into
masterfrom
260828.ttl-overflow-docs
Aug 28, 2026
Merged

Correct the extreme-ttl doc claims about the sharded stores#322
jaemk merged 2 commits into
masterfrom
260828.ttl-overflow-docs

Conversation

@jaemk

@jaemk jaemk commented Aug 28, 2026

Copy link
Copy Markdown
Owner

Four comments claimed that an overflowing ttl stores no deadline "matching the sharded TTL stores". That is false today.

The single-owner stores hold the ttl as a raw Duration and let now.checked_add(ttl) overflow to None, which means never-expires. The sharded stores hold it as an AtomicU64 of nanos and clamp on the way in (ttl.as_nanos().min(u64::MAX as u128)), so checked_add is practically unreachable and they stamp a real deadline about 584 years out. Both behaviors are already pinned by tests, including a cross-family one that asserts the split on purpose.

  • Correct compute_expires_at on TtlCache and LruTtlCache, cache_set on TtlCache, and a test doc comment in tests/v3_traits.rs, all of which repeated the claim.
  • Point each at the design record and the cross-family test rather than restating the mechanism four times.

Docs only, no behavior change. The record found two of these; a grep for the phrase found four, which is noted in the record. Whether to reconcile the two families is still an open decision there, and deliberately not settled here.

jaemk added 2 commits August 28, 2026 07:53
Four comments said an overflowing ttl stores no deadline "matching the sharded
TTL stores". That is false: the sharded stores clamp the configured ttl to
`u64::MAX` nanos before computing a deadline, so their `checked_add` is
practically unreachable and they stamp a real far-future `Instant` instead of
`None`. The two families genuinely diverge, and both sides are already pinned by
tests.

No behavior change. Whether to reconcile the families is still open in
specs/design/0048-ttl-overflow-vs-clamp.md.
@jaemk
jaemk merged commit d0c26a9 into master Aug 28, 2026
2 checks passed
@jaemk
jaemk deleted the 260828.ttl-overflow-docs branch August 28, 2026 17:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant