2 unstable releases

0.2.0 Oct 18, 2021
0.1.0 Jun 15, 2018

#82 in Caching

Download history 19081/week @ 2024-12-01 17093/week @ 2024-12-08 12930/week @ 2024-12-15 4363/week @ 2024-12-22 4505/week @ 2024-12-29 12176/week @ 2025-01-05 17837/week @ 2025-01-12 14865/week @ 2025-01-19 21686/week @ 2025-01-26 17743/week @ 2025-02-02 16439/week @ 2025-02-09 12751/week @ 2025-02-16 14648/week @ 2025-02-23 14613/week @ 2025-03-02 17499/week @ 2025-03-09 15689/week @ 2025-03-16

63,051 downloads per month
Used in 57 crates (18 directly)

MIT license

10KB
155 lines

rust-cache-control

Rust crate to parse the HTTP Cache-Control header.

use cache_control::{Cachability, CacheControl};
use std::time::Duration;

let cache_control = CacheControl::from_header("Cache-Control: public, max-age=60").unwrap();
assert_eq!(cache_control.cachability, Some(Cachability::Public));
assert_eq!(cache_control.max_age, Some(Duration::from_secs(60)));

lib.rs:

Rust crate to parse the HTTP Cache-Control header.

Example

use cache_control::{Cachability, CacheControl};
use std::time::Duration;

let cache_control = CacheControl::from_header("Cache-Control: public, max-age=60").unwrap();
assert_eq!(cache_control.cachability, Some(Cachability::Public));
assert_eq!(cache_control.max_age, Some(Duration::from_secs(60)));

No runtime deps