pub struct CacheRuntime { /* private fields */ }Expand description
Ties policy resolution + content-addressed key derivation + single-flight
compute-through into one call the dispatch path makes per tool. The
enterprise injects a Redis backend + the real tenant; the OSS default is
an in-process backend under a "local" tenant. This is the whole runtime
contract for §85 — a hit returns before compute runs (so a budget gate
placed after the lookup never sees it, D85.3).
Implementations§
Source§impl CacheRuntime
impl CacheRuntime
pub fn new(backend: Arc<dyn CacheBackend>, tenant: impl Into<String>) -> Self
Sourcepub fn in_process() -> Self
pub fn in_process() -> Self
In-process, single-tenant default (OSS runtime with no injected tier).
Sourcepub fn dispatch<F, E>(
&self,
ir: &IRProgram,
tool: &IRToolSpec,
args: &[(String, String)],
compute: F,
) -> Result<CacheOutcome, E>
pub fn dispatch<F, E>( &self, ir: &IRProgram, tool: &IRToolSpec, args: &[(String, String)], compute: F, ) -> Result<CacheOutcome, E>
Look up (or compute-and-store) a tool result. args is the full bound
(name, value) set; the key: subset (if any) is applied here.
compute runs ONLY on a miss and its error is never cached (D85.10).
Sourcepub fn invalidate(&self, cache_name: &str)
pub fn invalidate(&self, cache_name: &str)
Flush a cache namespace (called when an emit fires on one of its
invalidate_on: channels).