2 unstable releases

0.2.0 Oct 18, 2021
0.1.0 Jun 15, 2018

#71 in Caching

Download history 9229/week @ 2024-03-14 9637/week @ 2024-03-21 10869/week @ 2024-03-28 12587/week @ 2024-04-04 10724/week @ 2024-04-11 11492/week @ 2024-04-18 13569/week @ 2024-04-25 14727/week @ 2024-05-02 13387/week @ 2024-05-09 15075/week @ 2024-05-16 13979/week @ 2024-05-23 15336/week @ 2024-05-30 13389/week @ 2024-06-06 12868/week @ 2024-06-13 12218/week @ 2024-06-20 9826/week @ 2024-06-27

51,367 downloads per month
Used in 39 crates (14 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