2 unstable releases

0.2.0 Oct 18, 2021
0.1.0 Jun 15, 2018

#25 in Caching

Download history 1542/week @ 2022-01-25 1217/week @ 2022-02-01 1066/week @ 2022-02-08 1392/week @ 2022-02-15 1140/week @ 2022-02-22 1520/week @ 2022-03-01 2482/week @ 2022-03-08 2427/week @ 2022-03-15 2269/week @ 2022-03-22 2150/week @ 2022-03-29 1736/week @ 2022-04-05 2499/week @ 2022-04-12 3140/week @ 2022-04-19 2169/week @ 2022-04-26 3072/week @ 2022-05-03 2690/week @ 2022-05-10

11,494 downloads per month
Used in 6 crates (2 directly)

MIT license

9KB
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