nats

package module
v0.0.19 Latest Latest
Warning

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

Go to latest
Published: Mar 14, 2026 License: MIT Imports: 14 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Factory

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

Factory function create new Nats instance.

Types

type Nats

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

Nats provider type.

func (*Nats) Delete

func (provider *Nats) Delete(key string)

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

func (*Nats) DeleteMany

func (provider *Nats) DeleteMany(key string)

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

func (*Nats) Get

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

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

func (*Nats) GetMultiLevel

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

func (provider *Nats) Init() error

Init method will.

func (*Nats) ListKeys

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

ListKeys method returns the list of existing keys.

func (*Nats) MapKeys

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

MapKeys method returns a map with the key and value.

func (*Nats) Name

func (provider *Nats) Name() string

Name returns the storer name.

func (*Nats) Reset

func (provider *Nats) Reset() error

Reset method will reset or close provider.

func (*Nats) Set

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

Set method will store the response in Nats provider.

func (*Nats) SetMultiLevel

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

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