memo

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2023 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Func

type Func[K comparable, V any] func(ctx context.Context, key K, cleanup func()) (V, error)

Func is the type of the function to memoize.

type Memo

type Memo[K comparable, V any] struct {
	// Log specifies an optional logger for cleanup.
	// If empty, logging is discard
	Log logr.Logger
	// contains filtered or unexported fields
}

func New

func New[K comparable, V any](f Func[K, V]) *Memo[K, V]

func (*Memo[K, V]) Get

func (memo *Memo[K, V]) Get(ctx context.Context, key K) (value V, err error)

Jump to

Keyboard shortcuts

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