From 6bbf0eae11f8142f6d21fda4c25e4c1b3c94aebf Mon Sep 17 00:00:00 2001 From: Pavlo Ratushnyi Date: Sun, 25 Oct 2026 02:31:20 +0100 Subject: [PATCH] prefix cache: LELEKA_PREFIX_RETENTION_S sets the session retention (diagnostic knob) Co-Authored-By: Claude Sonnet 5.5 --- .../src/qwen_forward/original_serve_prefix.rs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/crates/leleka-runtime/src/qwen_forward/original_serve_prefix.rs b/crates/leleka-runtime/src/qwen_forward/original_serve_prefix.rs index d35bb714..f15c81a5 100644 --- a/crates/leleka-runtime/src/qwen_forward/original_serve_prefix.rs +++ b/crates/leleka-runtime/src/qwen_forward/original_serve_prefix.rs @@ -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::().ok()) { + policy.retention_ms = seconds.saturating_mul(1000); + } + policy + }, laptop: false, } }