pub struct CacheDefinition {
pub name: String,
pub backend: String,
pub ttl: Option<String>,
pub key_params: Vec<String>,
pub default_policy: bool,
pub apply_to_effects: Vec<String>,
pub invalidate_on: Vec<String>,
pub loc: Loc,
pub leading_trivia: Vec<Trivia>,
pub trailing_trivia: Vec<Trivia>,
}Expand description
cache Name { backend:, ttl:, key:, default:, apply_to_effects:, invalidate_on: } — §Fase 85.a, a named, referenced result-memoization
policy resolved per tool.cache: / retrieve.cache: (mirrors
CorsDefinition’s named-and-referenced shape).
The load-bearing idea (D85.1): cacheability derives from the type system’s
existing effects: pure proof — a pure tool is safe to cache by
construction. A default: true cache auto-covers every pure tool with
zero per-tool annotation; widening apply_to_effects: beyond [pure] is
allowed but the compiler names every non-pure tool it covers (W013) AND
forces a finite ttl: (T865 — you may cache a proven-deterministic result
forever, never a non-deterministic one).
Unknown fields are a hard parse error (the §83 D83.7 discipline) — a cache governs correctness (serving a stale/foreign result is a real bug), so a typo’d field can never silently mean “no policy.”
Fields§
§name: String§backend: Stringredis (multi-replica, enterprise tier) or in_process (the OSS
default single-replica tier). Empty ⇒ in_process. Validated against a
closed catalog at check time.
ttl: Option<String>Time-to-live as a duration literal ("10s", "5m", "1h"), same lexer
convention as cors.max_age/tool.timeout. None ⇒ “cache forever” —
sound ONLY for a provably-pure cache; a non-pure cache with no ttl:
is axon-T865 (D85.9).
key_params: Vec<String>key: [param, ...] — the SUBSET of the covered tool’s parameters:
whose bound values form the cache key. Empty ⇒ ALL bound parameters
(the automatic, zero-friction default). Used when one bound arg — e.g. a
request_id — must NOT affect the key.
default_policy: booldefault: true ⇒ this cache auto-covers every eligible tool in the
module without a per-tool cache: reference. At most one per module
(axon-T863). Default false.
apply_to_effects: Vec<String>apply_to_effects: [pure, ...] — the effect classes this cache is
willing to memoise. Empty ⇒ [pure] (the only provably-safe default).
Any member beyond pure is a WIDENING (W013 names each covered tool)
and forces a finite ttl: (T865).
invalidate_on: Vec<String>invalidate_on: [Channel, ...] — an emit on any listed channel
flushes this cache’s namespace. Each must resolve to a declared
channel (axon-T864). Reuses the §13 pub/sub, not a second mechanism.
loc: Loc§leading_trivia: Vec<Trivia>Fase 14.b — leading comment trivia.
trailing_trivia: Vec<Trivia>Fase 14.b — trailing comment trivia.
Trait Implementations§
Source§impl Debug for CacheDefinition
impl Debug for CacheDefinition
Source§impl Default for CacheDefinition
impl Default for CacheDefinition
Source§fn default() -> CacheDefinition
fn default() -> CacheDefinition
Auto Trait Implementations§
impl Freeze for CacheDefinition
impl RefUnwindSafe for CacheDefinition
impl Send for CacheDefinition
impl Sync for CacheDefinition
impl Unpin for CacheDefinition
impl UnsafeUnpin for CacheDefinition
impl UnwindSafe for CacheDefinition
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