litellm/litellm/rust/crates/cache-memory
yujonglee 9986dab8a1
fix(cache-memory): rebuild the in-memory cache on an exact expiry index (#51388)
The cache copied Python's lazy expiry heap. Deleting or re-arming a key
left a stale heap record, and a longer-lived key at the top kept those
records in memory without bound. A TTL past the end of Duration also
panicked while the lock was held, which poisoned it for every later call

The cache now keeps one index record per entry in a BTreeSet and removes
it with the entry, so there is nothing to compact. A write picks
Expiry::KeepExisting or Expiry::Refresh, update() reads and writes under
one lock, and deadlines saturate

The Redis stores' memory tier uses update() and drops its second mutex.
RouterCooldowns no longer panics on a cooldown too long to measure, and
both crates lock with parking_lot
2026-11-13 13:16:33 -08:00
..
src fix(cache-memory): rebuild the in-memory cache on an exact expiry index (#51388) 2026-11-13 13:16:33 -08:00
tests fix(cache-memory): rebuild the in-memory cache on an exact expiry index (#51388) 2026-11-13 13:16:33 -08:00
Cargo.toml fix(cache-memory): rebuild the in-memory cache on an exact expiry index (#51388) 2026-11-13 13:16:33 -08:00