Documentation ¶
Overview ¶
Package cachecontrol provides HTTP Cache-Control header parsing with some utility functions to quickly deal with directives values.
Index ¶
- type CacheControl
- func (c CacheControl) MaxAge() time.Duration
- func (c CacheControl) MaxStale() time.Duration
- func (c CacheControl) MinFresh() time.Duration
- func (c CacheControl) MustRevalidate() bool
- func (c CacheControl) NoCache() (bool, string)
- func (c CacheControl) NoStore() bool
- func (c CacheControl) NoTransform() bool
- func (c CacheControl) OnlyIfCached() bool
- func (c CacheControl) Private() (bool, string)
- func (c CacheControl) ProxyRevalidate() bool
- func (c CacheControl) Public() bool
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CacheControl ¶
CacheControl holds Cache-Control directives and gives a few utility methods to quickly deal with directives values
func Parse ¶
func Parse(directive string) CacheControl
Parse parses the cache directive of a Cache-Control header and returns a CacheControl
func (CacheControl) MaxAge ¶
func (c CacheControl) MaxAge() time.Duration
func (CacheControl) MaxStale ¶
func (c CacheControl) MaxStale() time.Duration
MaxStale returns -1 if the directive wasn't present or if an error happened during parsing the value. It returns math.MaxInt64 if it was present but if no value was provided. Otherwise, it returns the provided duration
func (CacheControl) MinFresh ¶
func (c CacheControl) MinFresh() time.Duration
func (CacheControl) MustRevalidate ¶
func (c CacheControl) MustRevalidate() bool
func (CacheControl) NoCache ¶
func (c CacheControl) NoCache() (bool, string)
func (CacheControl) NoStore ¶
func (c CacheControl) NoStore() bool
func (CacheControl) NoTransform ¶
func (c CacheControl) NoTransform() bool
func (CacheControl) OnlyIfCached ¶
func (c CacheControl) OnlyIfCached() bool
func (CacheControl) Private ¶
func (c CacheControl) Private() (bool, string)
func (CacheControl) ProxyRevalidate ¶
func (c CacheControl) ProxyRevalidate() bool
func (CacheControl) Public ¶
func (c CacheControl) Public() bool
Click to show internal directories.
Click to hide internal directories.