2 unstable releases

0.2.0 Oct 18, 2021
0.1.0 Jun 15, 2018

#69 in Caching

Download history 16138/week @ 2024-07-20 15493/week @ 2024-07-27 14437/week @ 2024-08-03 14535/week @ 2024-08-10 15820/week @ 2024-08-17 13608/week @ 2024-08-24 14509/week @ 2024-08-31 16266/week @ 2024-09-07 13762/week @ 2024-09-14 16136/week @ 2024-09-21 16635/week @ 2024-09-28 15666/week @ 2024-10-05 15017/week @ 2024-10-12 17307/week @ 2024-10-19 14082/week @ 2024-10-26 14297/week @ 2024-11-02

62,884 downloads per month
Used in 47 crates (17 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