pub struct Config {
pub header: HeaderName,
pub methods: Vec<Method>,
pub ttl_secs: u64,
pub scope: Scope,
pub coalesce_inflight: bool,
pub inflight_wait_timeout_ms: Option<u64>,
pub max_cached_body_bytes: usize,
pub max_request_body_bytes: usize,
pub verify_payload: bool,
pub cache_error_statuses: bool,
}Available on crate feature
plugins only.Expand description
Cache policy and matching configuration.
Fields§
§header: HeaderNameHeader that carries the idempotency key.
methods: Vec<Method>Methods to protect. Default: [POST].
ttl_secs: u64Time-to-live for cached results (seconds). Default: 86400 (24h).
scope: ScopeInclude method+path in the cache key. Default: MethodAndPath.
coalesce_inflight: boolIf true, concurrent calls with same key wait for the first to finish. Default: true.
inflight_wait_timeout_ms: Option<u64>Optional timeout for waiting on in-flight (milliseconds). Default: None (wait indefinitely).
max_cached_body_bytes: usizeMaximum response body size to cache (bytes). Default: 1 MiB.
max_request_body_bytes: usizeMaximum request body size to hash (bytes). Requests exceeding this are rejected with 413.
verify_payload: boolIf true, enforce identical payload for the same key; otherwise only the key is checked.
cache_error_statuses: boolIf true, also cache non-success statuses. Default: true.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for Config
impl RefUnwindSafe for Config
impl Send for Config
impl Sync for Config
impl Unpin for Config
impl UnsafeUnpin for Config
impl UnwindSafe for Config
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
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>
Converts
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>
Converts
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