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).
Auto Trait Implementations§
impl !RefUnwindSafe for CacheRuntime
impl !UnwindSafe for CacheRuntime
impl Freeze for CacheRuntime
impl Send for CacheRuntime
impl Sync for CacheRuntime
impl Unpin for CacheRuntime
impl UnsafeUnpin for CacheRuntime
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more