memorycache

package
v1.5.3 Latest Latest
Warning

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

Go to latest
Published: Jun 28, 2022 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MemoryCache

type MemoryCache struct {
	// contains filtered or unexported fields
}

MemoryCache is an utility MemoryCache.

func New

func New(spec *Spec) *MemoryCache

New creates a MemoryCache.

func (*MemoryCache) Load

func (mc *MemoryCache) Load(ctx context.HTTPContext) (loaded bool)

Load tries to load cache for HTTPContext.

func (*MemoryCache) Store

func (mc *MemoryCache) Store(ctx context.HTTPContext)

Store tries to store cache for HTTPContext.

type Spec

type Spec struct {
	Expiration    string   `yaml:"expiration" jsonschema:"required,format=duration"`
	MaxEntryBytes uint32   `yaml:"maxEntryBytes" jsonschema:"required,minimum=1"`
	Codes         []int    `yaml:"codes" jsonschema:"required,minItems=1,uniqueItems=true,format=httpcode-array"`
	Methods       []string `yaml:"methods" jsonschema:"required,minItems=1,uniqueItems=true,format=httpmethod-array"`
}

Spec describes the MemoryCache.

Jump to

Keyboard shortcuts

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