2 unstable releases

0.2.0 Oct 18, 2021
0.1.0 Jun 15, 2018

#68 in Caching

Download history 13943/week @ 2024-09-17 16031/week @ 2024-09-24 17589/week @ 2024-10-01 14324/week @ 2024-10-08 16063/week @ 2024-10-15 17147/week @ 2024-10-22 13414/week @ 2024-10-29 13209/week @ 2024-11-05 15860/week @ 2024-11-12 17216/week @ 2024-11-19 16817/week @ 2024-11-26 18050/week @ 2024-12-03 16112/week @ 2024-12-10 12086/week @ 2024-12-17 3729/week @ 2024-12-24 3657/week @ 2024-12-31

39,016 downloads per month
Used in 52 crates (20 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