pub struct RouteCache {
pub ttl_secs: u64,
pub stale_while_revalidate_secs: Option<u64>,
pub max_body_bytes: u64,
pub vary: Vec<String>,
pub coalescing: Option<RouteCacheCoalescing>,
}Expand description
Route-scoped response caching policy (DW-037). Absent (the
default): the route’s responses are never cached, buffered, or
stamped with cache headers — bytes flow exactly as before. Presence
opts the route’s GET traffic into the local response cache behind
the CacheStore extension seam (extensions domain).
Semantics (frozen; enforcement lives in dataplane::response_cache):
- Only PROXY-action routes cache. The key folds in the route name, the consumer, the inbound path + query, and the effective vary set’s request header values — two consumers (or two vary dimensions) never share an entry.
- Freshness is the configured
ttl_secs, full stop: upstream freshness directives other than the storage vetoes (no-store/private/no-cache) are deliberately ignored — the OPERATOR, not the origin, owns how long the gateway holds an entry. Withinstale_while_revalidate_secsafter expiry the entry is served stale while a single background revalidation refreshes it; past that window the next request revalidates synchronously (conditional on the stored validator). ETaground-trips: a stored entry’s ETag backs clientIf-None-Match304s from the cache and upstream revalidation (If-None-Matchon the forwarded fetch; a 304 refreshes the entry without re-sending the body).
Fields§
§ttl_secs: u64Freshness lifetime, in seconds. Required: a cache entry without a lifetime is an unbounded staleness bug, so there is no default. Validation rejects 0 and values above 24 hours.
stale_while_revalidate_secs: Option<u64>How long past expiry the entry may be served stale while a background revalidation runs (DW-037 stale-while-revalidate). Absent/0: no stale serving — an expired entry revalidates synchronously. Validation bounds the value to 24 hours.
max_body_bytes: u64Per-entry body cap in bytes: responses at or under the cap are buffered and stored; larger responses pass through unstored and unbuffered (the zero-buffering principle — the cap is the buffering opt-in’s hard edge). Absent: 1 MiB. Validation bounds the range [1, 16 MiB].
vary: Vec<String>Extra request header names folded into the cache key (the
configured half of the variance model — see the module docs).
The policy-derived halves (Accept for match.accept routes,
Origin for CORS routes) are added at snapshot compile and
need not (but may) be listed. Validation rejects duplicates,
hop-by-hop/framing names, Authorization/Cookie (requests
carrying them are never cacheable, so varying on them is dead
configuration), and X-Consumer-* (consumer identity is already
a key component).
coalescing: Option<RouteCacheCoalescing>Request coalescing (DW-038): collapse concurrent identical
cacheable GETs on this route into ONE upstream call — the first
miss (the leader) fetches while the rest (followers) wait,
bounded, and replay the leader’s stored outcome. Absent (the
default): every miss fetches independently, exactly as before.
Presence enables; see RouteCacheCoalescing.
Trait Implementations§
Source§impl Clone for RouteCache
impl Clone for RouteCache
Source§fn clone(&self) -> RouteCache
fn clone(&self) -> RouteCache
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for RouteCache
impl Debug for RouteCache
Source§impl<'de> Deserialize<'de> for RouteCache
impl<'de> Deserialize<'de> for RouteCache
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl JsonSchema for RouteCache
impl JsonSchema for RouteCache
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Source§fn inline_schema() -> bool
fn inline_schema() -> bool
$ref keyword. Read moreSource§impl PartialEq for RouteCache
impl PartialEq for RouteCache
Source§impl Serialize for RouteCache
impl Serialize for RouteCache
impl StructuralPartialEq for RouteCache
Auto Trait Implementations§
impl Freeze for RouteCache
impl RefUnwindSafe for RouteCache
impl Send for RouteCache
impl Sync for RouteCache
impl Unpin for RouteCache
impl UnwindSafe for RouteCache
Blanket Implementations§
§impl<T> AnyExt for T
impl<T> AnyExt for T
§fn downcast_ref<T>(this: &Self) -> Option<&T>where
T: Any,
fn downcast_ref<T>(this: &Self) -> Option<&T>where
T: Any,
T behind reference§fn downcast_mut<T>(this: &mut Self) -> Option<&mut T>where
T: Any,
fn downcast_mut<T>(this: &mut Self) -> Option<&mut T>where
T: Any,
T behind mutable reference§fn downcast_rc<T>(this: Rc<Self>) -> Result<Rc<T>, Rc<Self>>where
T: Any,
fn downcast_rc<T>(this: Rc<Self>) -> Result<Rc<T>, Rc<Self>>where
T: Any,
T behind Rc pointer§fn downcast_arc<T>(this: Arc<Self>) -> Result<Arc<T>, Arc<Self>>where
T: Any,
fn downcast_arc<T>(this: Arc<Self>) -> Result<Arc<T>, Arc<Self>>where
T: Any,
T behind Arc pointer§fn downcast_box<T>(this: Box<Self>) -> Result<Box<T>, Box<Self>>where
T: Any,
fn downcast_box<T>(this: Box<Self>) -> Result<Box<T>, Box<Self>>where
T: Any,
T behind Box pointer§fn downcast_move<T>(this: Self) -> Option<T>
fn downcast_move<T>(this: Self) -> Option<T>
Self to T,
useful only in generic context as a workaround for specializationSource§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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T, X> CoerceTo<T> for Xwhere
T: CoerceFrom<X> + ?Sized,
impl<T, X> CoerceTo<T> for Xwhere
T: CoerceFrom<X> + ?Sized,
fn coerce_rc_to(self: Rc<X>) -> Rc<T>
fn coerce_box_to(self: Box<X>) -> Box<T>
fn coerce_ref_to(&self) -> &T
fn coerce_mut_to(&mut self) -> &mut T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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