Struct hyper::header::CacheControl [] [src]

pub struct CacheControl(pub Vec<CacheDirective>);

Cache-Control header, defined in RFC7234

The Cache-Control header field is used to specify directives for caches along the request/response chain. Such cache directives are unidirectional in that the presence of a directive in a request does not imply that the same directive is to be given in the response.

ABNF

Cache-Control   = 1#cache-directive
cache-directive = token [ "=" ( token / quoted-string ) ]

Example values

Examples

use hyper::header::{Headers, CacheControl, CacheDirective};

let mut headers = Headers::new();
headers.set(
    CacheControl(vec![CacheDirective::MaxAge(86400u32)])
);
use hyper::header::{Headers, CacheControl, CacheDirective};

let mut headers = Headers::new();
headers.set(
    CacheControl(vec![
        CacheDirective::NoCache,
        CacheDirective::Private,
        CacheDirective::MaxAge(360u32),
        CacheDirective::Extension("foo".to_owned(),
                                  Some("bar".to_owned())),
    ])
);