2 unstable releases

0.2.0 Oct 18, 2021
0.1.0 Jun 15, 2018

#111 in Caching

Download history 5581/week @ 2023-11-24 6864/week @ 2023-12-01 6715/week @ 2023-12-08 6333/week @ 2023-12-15 2658/week @ 2023-12-22 4007/week @ 2023-12-29 6377/week @ 2024-01-05 7416/week @ 2024-01-12 5926/week @ 2024-01-19 7427/week @ 2024-01-26 9054/week @ 2024-02-02 8792/week @ 2024-02-09 5797/week @ 2024-02-16 6301/week @ 2024-02-23 7869/week @ 2024-03-01 4288/week @ 2024-03-08

25,433 downloads per month
Used in 33 crates (12 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