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 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more