Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Memoizer ¶
Memoizer provides a mechanism to memoize results of functions
func NewMemoizer ¶
NewMemoizer returns a new Memoizer
func (*Memoizer[T]) Memoize ¶
func (m *Memoizer[T]) Memoize(ctx context.Context, key any, fn func(context.Context) (T, error)) (T, error)
Memoize returns the last value of the function fn when called with the given key. If not available in the cache, then the function is called and its result is cached.
Click to show internal directories.
Click to hide internal directories.