2 unstable releases

0.2.0 Oct 18, 2021
0.1.0 Jun 15, 2018

#66 in Caching

Download history 13696/week @ 2024-11-08 16866/week @ 2024-11-15 15716/week @ 2024-11-22 19018/week @ 2024-11-29 17206/week @ 2024-12-06 13502/week @ 2024-12-13 6286/week @ 2024-12-20 4008/week @ 2024-12-27 9669/week @ 2025-01-03 17212/week @ 2025-01-10 16141/week @ 2025-01-17 20602/week @ 2025-01-24 17495/week @ 2025-01-31 18170/week @ 2025-02-07 4981/week @ 2025-02-14

44,647 downloads per month
Used in 56 crates (18 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