2 unstable releases

0.2.0 Oct 18, 2021
0.1.0 Jun 15, 2018

#72 in Caching

Download history 7539/week @ 2024-01-10 5466/week @ 2024-01-17 7074/week @ 2024-01-24 8935/week @ 2024-01-31 9364/week @ 2024-02-07 6200/week @ 2024-02-14 6120/week @ 2024-02-21 7209/week @ 2024-02-28 8959/week @ 2024-03-06 9251/week @ 2024-03-13 9928/week @ 2024-03-20 10314/week @ 2024-03-27 11850/week @ 2024-04-03 11948/week @ 2024-04-10 11106/week @ 2024-04-17 10612/week @ 2024-04-24

49,239 downloads per month
Used in 36 crates (13 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