otter

package module
v0.0.9 Latest Latest
Warning

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

Go to latest
Published: Sep 21, 2024 License: MIT Imports: 9 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Factory

func Factory(otterCfg core.CacheProvider, logger core.Logger, stale time.Duration) (core.Storer, error)

Factory function create new Otter instance.

Types

type Otter

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

Otter provider type.

func (*Otter) Delete

func (provider *Otter) Delete(key string)

Delete method will delete the response in Otter provider if exists corresponding to key param.

func (*Otter) DeleteMany

func (provider *Otter) DeleteMany(key string)

DeleteMany method will delete the responses in Otter provider if exists corresponding to the regex key param.

func (*Otter) Get

func (provider *Otter) Get(key string) []byte

Get method returns the populated response if exists, empty response then.

func (*Otter) GetMultiLevel

func (provider *Otter) GetMultiLevel(key string, req *http.Request, validator *core.Revalidator) (fresh *http.Response, stale *http.Response)

GetMultiLevel tries to load the key and check if one of linked keys is a fresh/stale candidate.

func (*Otter) Init

func (provider *Otter) Init() error

Init method will.

func (*Otter) ListKeys

func (provider *Otter) ListKeys() []string

ListKeys method returns the list of existing keys.

func (*Otter) MapKeys

func (provider *Otter) MapKeys(prefix string) map[string]string

MapKeys method returns a map with the key and value.

func (*Otter) Name

func (provider *Otter) Name() string

Name returns the storer name.

func (*Otter) Reset

func (provider *Otter) Reset() error

Reset method will reset or close provider.

func (*Otter) Set

func (provider *Otter) Set(key string, value []byte, duration time.Duration) error

Set method will store the response in Otter provider.

func (*Otter) SetMultiLevel

func (provider *Otter) SetMultiLevel(baseKey, variedKey string, value []byte, variedHeaders http.Header, etag string, duration time.Duration, realKey string) error

SetMultiLevel tries to store the key with the given value and update the mapping key to store metadata.

func (*Otter) Uuid added in v0.0.4

func (provider *Otter) Uuid() string

Uuid returns an unique identifier.

Directories

Path Synopsis
caddy module

Jump to

Keyboard shortcuts

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