cache

package
v0.5.5 Latest Latest
Warning

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

Go to latest
Published: May 15, 2024 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.

func New

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

New returns a new generic Cache

func (*Cache) Get

func (c *Cache) Get(ctx context.Context, index string, fetchIndex string, opts *api.Options) (interface{}, 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) StartGarbageCollector

func (c *Cache) StartGarbageCollector(refreshRate time.Duration)

StartGarbageCollector is a blocking func that will run the garbage collector against the cache.

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