handler

package
v0.0.0-...-baa1f0e Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 31, 2023 License: Apache-2.0 Imports: 1 Imported by: 0

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().

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL