cache

package
v0.9.3 Latest Latest
Warning

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

Go to latest
Published: Jun 3, 2025 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cache

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

Cache is a generic cache store - that supports a handler

func New

func New(log *logrus.Entry, timeout time.Duration, handler Handler) *Cache

New returns a new generic Cache.

func (*Cache) Delete added in v0.9.0

func (c *Cache) Delete(index string)

func (*Cache) Get

func (c *Cache) Get(ctx context.Context, index string, fetchIndex string, opts *api.Options) (item interface{}, err error)

Get returns the cache item from the store given the index. Will populate the cache if the index does not currently exist.

func (*Cache) Shutdown added in v0.9.0

func (c *Cache) Shutdown()

func (*Cache) Update added in v0.9.0

func (c *Cache) Update(index string, item interface{})

type Handler

type Handler interface {
	// Fetch should fetch an item by the given index and options
	Fetch(ctx context.Context, index string, opts *api.Options) (interface{}, error)
}

Handler is an interface for implementations of the cache fetch.

Jump to

Keyboard shortcuts

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