Skip to content

feat: remove CacheSetError, rename TtlSortedCache insert* to set*, wrap order-method values in CacheValue - #293

Merged
jaemk merged 1 commit into
masterfrom
260719.pre-3.0-breaking-polish
Jul 23, 2026
Merged

feat: remove CacheSetError, rename TtlSortedCache insert* to set*, wrap order-method values in CacheValue#293
jaemk merged 1 commit into
masterfrom
260719.pre-3.0-breaking-polish

Conversation

@jaemk

@jaemk jaemk commented Jul 20, 2026

Copy link
Copy Markdown
Owner

Breaking changes ahead of 3.0.0 final.

  • Remove CacheSetError: a TTL that would overflow Instant bounds now stores the entry with no expiry (never expires) on every set path, matching the sharded TTL stores (cache_set already behaved this way). TtlCache / LruTtlCache / TtlSortedCache set Cached::Error = Infallible, so every built-in in-memory store is infallible; type Error remains for custom and IO stores.
  • Rename TtlSortedCache::insert / insert_ttl / insert_evict / insert_ttl_evict to set / set_with_ttl / set_evict / set_with_ttl_evict, returning Option<V> instead of Result.
  • Unify the LRU-family order methods on one shape: iter_order() -> Vec<(K, CacheValue<V, M>)> and value_order() -> Vec<CacheValue<V, M>> on LruCache, LruTtlCache, and ExpiringLruCache. CacheValue<V, M = ()> (new root re-export) derefs to V, compares against bare values (PartialEq<V>), and exposes expires_at() on LruTtlCache entries (M = Option<Instant>). LruTtlCache no longer leaks bare (Option<Instant>, V) tuples.
  • Update migration guide sections 18/22/33/43, add sections 74/75; mark design doc 0020 declined (error split kept, TimeBounds gone).

…et*`, wrap order-method values in `CacheValue`

Breaking changes ahead of 3.0.0 final:

- remove `CacheSetError`: a TTL that would overflow `Instant` bounds now
  stores the entry with no expiry (never expires) on every set path,
  matching the sharded TTL stores (`cache_set` already behaved this way).
  `TtlCache` / `LruTtlCache` / `TtlSortedCache` set
  `Cached::Error = Infallible`, so every built-in in-memory store is
  infallible; the `type Error` machinery remains for custom and IO stores.
- rename `TtlSortedCache::insert` / `insert_ttl` / `insert_evict` /
  `insert_ttl_evict` to `set` / `set_with_ttl` / `set_evict` /
  `set_with_ttl_evict`, returning `Option<V>` instead of `Result`.
- unify the LRU-family order methods on one shape:
  `iter_order() -> Vec<(K, CacheValue<V, M>)>` and
  `value_order() -> Vec<CacheValue<V, M>>` on `LruCache`, `LruTtlCache`,
  and `ExpiringLruCache`. `CacheValue<V, M = ()>` (new root re-export)
  derefs to `V`, compares against bare values, and exposes per-entry
  metadata via typed accessors: `expires_at()` on `LruTtlCache` entries
  (`M = Option<Instant>`). `LruTtlCache` no longer leaks bare
  `(Option<Instant>, V)` tuples.

Migration guide sections 18/22/33/43 updated and 74/75 added; design doc
0020 closed out (error split kept, `TimeBounds` gone).
@jaemk
jaemk merged commit 42b726c into master Jul 23, 2026
1 check passed
@jaemk
jaemk deleted the 260719.pre-3.0-breaking-polish branch July 23, 2026 23:57
@jaemk
jaemk restored the 260719.pre-3.0-breaking-polish branch July 23, 2026 23:58
@jaemk
jaemk deleted the 260719.pre-3.0-breaking-polish branch July 23, 2026 23:58
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