badger

package module
v0.0.0-...-d6918ac Latest Latest
Warning

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

Go to latest
Published: Dec 18, 2024 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Factory

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

Factory function create new Badger instance.

Types

type Badger

type Badger struct {
	*badger.DB
	// contains filtered or unexported fields
}

Badger provider type.

func (*Badger) Delete

func (provider *Badger) Delete(key string)

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

func (*Badger) DeleteMany

func (provider *Badger) DeleteMany(key string)

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

func (*Badger) Get

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

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

func (*Badger) GetMultiLevel

func (provider *Badger) 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 (*Badger) Init

func (provider *Badger) Init() error

Init method will.

func (*Badger) ListKeys

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

ListKeys method returns the list of existing keys.

func (*Badger) MapKeys

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

MapKeys method returns a map with the key and value.

func (*Badger) Name

func (provider *Badger) Name() string

Name returns the storer name.

func (*Badger) Reset

func (provider *Badger) Reset() error

Reset method will reset or close provider.

func (*Badger) Set

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

Set method will store the response in Badger provider.

func (*Badger) SetMultiLevel

func (provider *Badger) 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 (*Badger) Uuid

func (provider *Badger) 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