mapcache

package module
v0.0.0-...-7608305 Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Item

type Item[V any] struct {
	V         V
	UpdatedAt time.Time
}

type MapCache

type MapCache[K comparable, V any] struct {
	TTL time.Duration
	// contains filtered or unexported fields
}

func New

func New[K comparable, V any](opts ...OptFunc) (*MapCache[K, V], error)

func (*MapCache[K, V]) All

func (mc *MapCache[K, V]) All() iter.Seq2[K, Item[V]]

func (*MapCache[K, V]) AllParallel

func (mc *MapCache[K, V]) AllParallel() iter.Seq2[K, Item[V]]

func (*MapCache[K, V]) Get

func (mc *MapCache[K, V]) Get(key K, up func() (V, error), opts ...OptFunc) (V, error)

type OptFunc

type OptFunc func(*options) error

func WithCleanup

func WithCleanup(ctx context.Context, interval time.Duration) OptFunc

func WithSize

func WithSize(size int) OptFunc

func WithTTL

func WithTTL(ttl time.Duration) OptFunc

Jump to

Keyboard shortcuts

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