const ( // Request Cache-Control directives MaxAge = "max-age" // used in response as well MaxStale = "max-stale" MinFresh = "min-fresh" NoCache = "no-cache" // used in response as well NoStore = "no-store" // used in response as well NoTransform = "no-transform" // used in response as well OnlyIfCached = "only-if-cached" // Response Cache-Control directive MustRevalidate = "must-revalidate" Public = "public" Private = "private" ProxyRevalidate = "proxy-revalidate" SMaxAge = "s-maxage" )
type RequestDirective struct {
// contains filtered or unexported fields
}
func ParseRequest(v string) (*RequestDirective, error)
ParseRequest parses the content of `Cache-Control` header of an HTTP Request.
func (d *RequestDirective) Extension(s string) string
func (d *RequestDirective) Extensions() map[string]string
func (d *RequestDirective) MaxAge() (uint64, bool)
func (d *RequestDirective) MaxStale() (uint64, bool)
func (d *RequestDirective) MinFresh() (uint64, bool)
func (d *RequestDirective) NoCache() bool
func (d *RequestDirective) NoStore() bool
func (d *RequestDirective) NoTransform() bool
func (d *RequestDirective) OnlyIfCached() bool
type ResponseDirective struct {
// contains filtered or unexported fields
}
func ParseResponse(v string) (*ResponseDirective, error)
ParseResponse parses the content of `Cache-Control` header of an HTTP Response.
func (d *ResponseDirective) Extension(s string) string
func (d *ResponseDirective) Extensions() map[string]string
func (d *ResponseDirective) MaxAge() (uint64, bool)
func (d *ResponseDirective) NoCache() []string
func (d *ResponseDirective) NoStore() bool
func (d *ResponseDirective) NoTransform() bool
func (d *ResponseDirective) Private() []string
func (d *ResponseDirective) ProxyRevalidate() bool
func (d *ResponseDirective) Public() bool
func (d *ResponseDirective) SMaxAge() (uint64, bool)
type TokenPair struct { Name string Value string }
func ParseRequestDirective(s string) (*TokenPair, error)
ParseRequestDirective parses a single token.
func ParseRequestDirectives(s string) ([]*TokenPair, error)
func ParseResponseDirective(s string) (*TokenPair, error)
func ParseResponseDirectives(s string) ([]*TokenPair, error)
type TokenValuePolicy int
const ( NoArgument TokenValuePolicy = iota TokenOnly QuotedStringOnly AnyTokenValue )