badger

package
v1.6.0-preview.4 Latest Latest
Warning

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

Go to latest
Published: Feb 16, 2023 License: AGPL-3.0 Imports: 13 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[E any] struct {
	// contains filtered or unexported fields
}

Cache is an in-memory cache. Each key-value pair stored in this cache have a TTL and one goroutine removes the key-value pair form the cache which is older than TTL time.

func New

func New[E any](origin string, logger logger.Logger, opts ...func(Cache[E])) (*Cache[E], error)

func (*Cache[E]) Read

func (e *Cache[E]) Read(key string) ([]E, error)

Read fetches all the entries for a given key from badgerDB

func (*Cache[E]) Stop

func (e *Cache[E]) Stop() error

func (*Cache[E]) Update

func (e *Cache[E]) Update(key string, value E) error

Update writes the entries into badger db with a TTL

Jump to

Keyboard shortcuts

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