2 unstable releases

0.2.0 Oct 18, 2021
0.1.0 Jun 15, 2018

#79 in Caching

Download history 6789/week @ 2024-02-27 8234/week @ 2024-03-05 9934/week @ 2024-03-12 9872/week @ 2024-03-19 8086/week @ 2024-03-26 13334/week @ 2024-04-02 12152/week @ 2024-04-09 10951/week @ 2024-04-16 12726/week @ 2024-04-23 13956/week @ 2024-04-30 13880/week @ 2024-05-07 14555/week @ 2024-05-14 14783/week @ 2024-05-21 13419/week @ 2024-05-28 15246/week @ 2024-06-04 10555/week @ 2024-06-11

56,598 downloads per month
Used in 37 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