This commit is contained in:
Mateusz Gruszczyński committed 2026-11-07 08:16:11 +01:00
1 parent c038ad44b3
commit cd3c28d390
33 files changed
+807 -221

No files matched your search

+11 -2
View File
@@ -126,10 +126,19 @@ impl Cache {
.uncacheable_until
.lock()
.unwrap_or_else(|e| e.into_inner());
if memo.len() >= UNCACHEABLE_MEMO_CAPACITY {
if memo.len() >= UNCACHEABLE_MEMO_CAPACITY && !memo.contains_key(&ticket.key) {
memo.retain(|_, until| *until > now);
if memo.len() >= UNCACHEABLE_MEMO_CAPACITY {
return;
// Keep hit-for-miss working for new keys under sustained churn:
// drop the marker closest to expiry instead of silently
// re-enabling request collapsing for this (uncacheable) key.
if let Some(oldest) = memo
.iter()
.min_by_key(|(_, until)| **until)
.map(|(key, _)| *key)
{
memo.remove(&oldest);
}
}
}
memo.insert(ticket.key, now + UNCACHEABLE_MEMO_TTL);