cache

package
v0.0.0-...-d791c0d Latest Latest
Warning

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

Go to latest
Published: Mar 11, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CacheHandler

type CacheHandler[TKey comparable, TVal any] interface {
	GetData(ctx context.Context, from *time.Time) (map[TKey]TVal, error)
	GetDeletes(ctx context.Context, from time.Time) (map[TKey]time.Time, error)
}

type LocalCache

type LocalCache[TKey comparable, TVal any] struct {
	// contains filtered or unexported fields
}

func NewLocalCache

func NewLocalCache[TKey comparable, TVal any](
	handler CacheHandler[TKey, TVal],
	updatePeriod time.Duration,
	deletesRetention time.Duration,
	getDataTime func(TVal) time.Time,
) *LocalCache[TKey, TVal]

func (*LocalCache[TKey, TVal]) Get

func (c *LocalCache[TKey, TVal]) Get(key TKey) (TVal, bool)

func (*LocalCache[TKey, TVal]) GetAll

func (c *LocalCache[TKey, TVal]) GetAll() map[TKey]TVal

func (*LocalCache[TKey, TVal]) GetSince

func (c *LocalCache[TKey, TVal]) GetSince(since time.Time) map[TKey]TVal

func (*LocalCache[TKey, TVal]) Len

func (c *LocalCache[TKey, TVal]) Len() int

func (*LocalCache[TKey, TVal]) StartCaching

func (c *LocalCache[TKey, TVal]) StartCaching(ctx context.Context) error

Jump to

Keyboard shortcuts

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