Skip to main content

capability_cache_ttl_decision

Function capability_cache_ttl_decision 

Source
pub fn capability_cache_ttl_decision(
    snapshot: Option<&CodexCapabilities>,
    ttl: Duration,
    now: SystemTime,
) -> CapabilityTtlDecision
Expand description

Decides whether a cached capability snapshot should be refreshed based on collected_at.

Callers can use this to apply a TTL/backoff in environments where filesystem metadata is missing or unreliable (e.g., FUSE/overlay filesystems) and when binaries are hot-swapped without changing fingerprints. When the TTL has not elapsed, reuse the provided snapshot; when expired, force a probe with CapabilityCachePolicy::Refresh (fingerprints present) or CapabilityCachePolicy::Bypass (metadata missing).

Recommended defaults: start with a 5 minute TTL when fingerprints exist and prefer Refresh for hot-swaps that reuse the same path; when metadata is missing, expect Bypass and back off further (e.g., stretch the TTL toward 10-15 minutes) to avoid tight probe loops.