CacheControl
parses Cache-Control header values (RFC 7234 ยง5.2) into a
map of lower-cased directive names to their values, with convenience accessors
for the common directives.
directive
(Fn [(Ref (Map String a) b), (Ref String c)] (Maybe a))
(directive m name)
looks up directive name (case-insensitive), returning its
value as (Maybe String). A present valueless directive yields (Just @"").
has?
(Fn [(Ref (Map String a) b), (Ref String c)] Bool)
(has? m name)
whether directive name (case-insensitive) is present.
max-age
(Fn [(Ref (Map String String) a)] (Maybe Int))
(max-age m)
the max-age delta-seconds as (Maybe Int), when present and
numeric.
must-revalidate?
(Fn [(Ref (Map String a) b)] Bool)
(must-revalidate? m)
whether the must-revalidate directive is present.
no-cache?
(Fn [(Ref (Map String a) b)] Bool)
(no-cache? m)
whether the no-cache directive is present.
no-store?
(Fn [(Ref (Map String a) b)] Bool)
(no-store? m)
whether the no-store directive is present.
parse
(Fn [(Ref String a)] (Map String String))
(parse s)
parses a Cache-Control header value into a map from lower-cased
directive names to values. A valueless directive (e.g. no-cache) maps to the
empty string; a quoted value has its surrounding quotes removed. Empty segments
are ignored, so an empty header yields an empty map.
private?
(Fn [(Ref (Map String a) b)] Bool)
(private? m)
whether the private response directive is present.
public?
(Fn [(Ref (Map String a) b)] Bool)
(public? m)
whether the public response directive is present.
s-maxage
(Fn [(Ref (Map String String) a)] (Maybe Int))
(s-maxage m)
the s-maxage delta-seconds as (Maybe Int), when present and
numeric.