Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type HandlerCache ¶
type HandlerCache struct { BuildCache func() ([]byte, error) // contains filtered or unexported fields }
HandlerCache represents a lazy cache for generating a byte array It is used to lazily marshal OpenAPI v2/v3 and lazily generate the ETag
func (*HandlerCache) Get ¶
func (c *HandlerCache) Get() ([]byte, error)
Get either returns the cached value or calls BuildCache() once before caching and returning its results. If BuildCache returns an error, the last valid value for the cache (from prior calls to New()) is used instead if possible.
func (*HandlerCache) New ¶
func (c *HandlerCache) New(cacheBuilder func() ([]byte, error)) HandlerCache
New creates a new HandlerCache for situations where a cache refresh is needed. This function is not thread-safe and should not be called at the same time as Get().
Click to show internal directories.
Click to hide internal directories.