prefix cache: LELEKA_PREFIX_RETENTION_S sets the session retention (diagnostic knob)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
Pavlo Ratushnyi
2026-10-25 02:31:20 +01:00
co-authored by Claude Sonnet 5.5
parent c3d4cce4e6
commit 6bbf0eae11
@@ -73,7 +73,15 @@ impl PrefixConfig {
block_tokens: 0,
max_nodes: 1024,
memory_floor: 3 << 30,
policy: PolicyParams::default(),
policy: {
// LELEKA_PREFIX_RETENTION_S: session retention in seconds (default 3600 = 60 minutes; 0 = no time limit); a
// diagnostic knob so the expiry path can be exercised in minutes
let mut policy = PolicyParams::default();
if let Some(seconds) = std::env::var("LELEKA_PREFIX_RETENTION_S").ok().and_then(|v| v.trim().parse::<u64>().ok()) {
policy.retention_ms = seconds.saturating_mul(1000);
}
policy
},
laptop: false,
}
}