| 318 | /// Configuration options for server-side caching. |
| 319 | #[derive(Debug, Clone)] |
| 320 | pub struct ServerCacheOptions { |
| 321 | /// Default TTL when response has no Cache-Control header. |
| 322 | pub default_ttl: Option<Duration>, |
| 323 | |
| 324 | /// Maximum TTL, even if response specifies longer. |
| 325 | pub max_ttl: Option<Duration>, |
| 326 | |
| 327 | /// Minimum TTL, even if response specifies shorter. |
| 328 | pub min_ttl: Option<Duration>, |
| 329 | |
| 330 | /// Whether to add X-Cache headers (HIT/MISS). |
| 331 | pub cache_status_headers: bool, |
| 332 | |
| 333 | /// Maximum response body size to cache (in bytes). |
| 334 | pub max_body_size: usize, |
| 335 | |
| 336 | /// Whether to cache responses without explicit Cache-Control. |
| 337 | pub cache_by_default: bool, |
| 338 | |
| 339 | /// Whether to respect Vary header for content negotiation. |
| 340 | /// |
| 341 | /// When true (default), cached responses are only served if the request's |
| 342 | /// headers match those specified in the response's Vary header. This is |
| 343 | /// enforced via `http-cache-semantics`. |
| 344 | pub respect_vary: bool, |
| 345 | |
| 346 | /// Whether to respect Authorization headers per RFC 9111 §3.5. |
| 347 | /// |
| 348 | /// When true (default), requests with `Authorization` headers are not cached |
| 349 | /// unless the response explicitly permits it via `public`, `s-maxage`, or |
| 350 | /// `must-revalidate` directives. |
| 351 | /// |
| 352 | /// This prevents accidental caching of authenticated responses that could |
| 353 | /// leak user-specific data to other users. |
| 354 | pub respect_authorization: bool, |
| 355 | } |
| 356 | |
| 357 | impl Default for ServerCacheOptions { |
| 358 | fn default() -> Self { |
nothing calls this directly
no outgoing calls
no test coverage detected