pub struct ResolvedCachePolicy {
pub cache_name: String,
pub ttl: Option<String>,
pub key_params: Vec<String>,
pub fingerprint: String,
pub output_type: String,
}Expand description
Everything the dispatch path needs to key ONE memoised call, resolved from
the IRProgram once, when the plan is built.
§Why this type exists
CacheRuntime::dispatch took &IRProgram because resolve_tool_cache
needs the whole module to answer “which cache governs this tool?” — the
default-policy rule is a property of the module, not of the tool. But
DispatchCtx carries no IRProgram, deliberately: it carries narrow,
pre-resolved catalogs (credentials, anchors, the v2.69.0 shield policies)
so the hot path looks nothing up that could have been looked up once.
Threading the IR through the runtime to satisfy one call would have inverted that, and for no gain: the answer cannot change between the deploy and the call. So resolution moves to where the IR already is, and the runtime receives the answer.
This is the v2.69.0 collect_shield_policies shape, and it is also the v2.87.0
discipline — resolve_tool_cache stays the ONE place that decides, and
gains a second caller rather than a second copy.
Fields§
§cache_name: StringThe governing cache’s name — also the backend NAMESPACE, so invalidate
flushes exactly this cache’s entries.
ttl: Option<String>Raw TTL literal ("5m"); None ⇒ cache-forever, sound only because
axon-T865 proved the memoised thing deterministic.
key_params: Vec<String>The key: subset; empty ⇒ every bound argument keys the entry.
fingerprint: StringThe declaration fingerprint — a redeploy that changes what is memoised changes this, so a behaviour change can never be served a result cached under the old behaviour.
output_type: StringPart of the key so two tools with identical arguments but different result types never collide.
Implementations§
Source§impl ResolvedCachePolicy
impl ResolvedCachePolicy
Sourcepub fn for_retrieve(cache: &IRCache, store_name: &str) -> Self
pub fn for_retrieve(cache: &IRCache, store_name: &str) -> Self
v2.89.0 — the policy governing a retrieve … cache: <Name>.
A retrieve names its cache directly, so there is no eligibility question
to resolve — but it still needs a fingerprint, and the honest one is the
STORE it reads. A redeploy that changes the store’s shape must not serve
rows cached against the old one, exactly as a changed tool declaration
must not. axon-T865 already forces a finite ttl: here,
because a store read is never pure.
Trait Implementations§
Source§impl Clone for ResolvedCachePolicy
impl Clone for ResolvedCachePolicy
Source§fn clone(&self) -> ResolvedCachePolicy
fn clone(&self) -> ResolvedCachePolicy
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more