2 unstable releases

0.2.0 Oct 18, 2021
0.1.0 Jun 15, 2018

#57 in Caching

Download history 6100/week @ 2023-01-25 6441/week @ 2023-02-01 6524/week @ 2023-02-08 6480/week @ 2023-02-15 7069/week @ 2023-02-22 5813/week @ 2023-03-01 6140/week @ 2023-03-08 5387/week @ 2023-03-15 5820/week @ 2023-03-22 6349/week @ 2023-03-29 3983/week @ 2023-04-05 6722/week @ 2023-04-12 5559/week @ 2023-04-19 5906/week @ 2023-04-26 5446/week @ 2023-05-03 6628/week @ 2023-05-10

24,801 downloads per month
Used in 24 crates (10 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