pub struct ServerCacheOptions {
pub default_ttl: Option<Duration>,
pub max_ttl: Option<Duration>,
pub min_ttl: Option<Duration>,
pub cache_status_headers: bool,
pub max_body_size: usize,
pub cache_by_default: bool,
pub respect_vary: bool,
pub respect_authorization: bool,
}Expand description
Configuration options for server-side caching.
Fields§
§default_ttl: Option<Duration>Default TTL when response has no Cache-Control header.
max_ttl: Option<Duration>Maximum TTL, even if response specifies longer.
min_ttl: Option<Duration>Minimum TTL, even if response specifies shorter.
cache_status_headers: boolWhether to add X-Cache headers (HIT/MISS).
max_body_size: usizeMaximum response body size to cache (in bytes).
cache_by_default: boolWhether to cache responses without explicit Cache-Control.
respect_vary: boolWhether to respect Vary header for content negotiation.
When true (default), cached responses are only served if the request’s
headers match those specified in the response’s Vary header. This is
enforced via http-cache-semantics.
Whether to respect Authorization headers per RFC 9111 §3.5.
When true (default), requests with Authorization headers are not cached
unless the response explicitly permits it via public, s-maxage, or
must-revalidate directives.
This prevents accidental caching of authenticated responses that could leak user-specific data to other users.
Trait Implementations§
Source§impl Clone for ServerCacheOptions
impl Clone for ServerCacheOptions
Source§fn clone(&self) -> ServerCacheOptions
fn clone(&self) -> ServerCacheOptions
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ServerCacheOptions
impl Debug for ServerCacheOptions
Auto Trait Implementations§
impl Freeze for ServerCacheOptions
impl RefUnwindSafe for ServerCacheOptions
impl Send for ServerCacheOptions
impl Sync for ServerCacheOptions
impl Unpin for ServerCacheOptions
impl UnwindSafe for ServerCacheOptions
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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