memo

package
v0.0.0-...-28009d5 Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2023 License: MPL-2.0 Imports: 2 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 func() (interface{}, error)

type Memo

type Memo struct {
	// contains filtered or unexported fields
}

func New

func New(f Func, cd time.Duration) *Memo

func (*Memo) Get

func (memo *Memo) Get() (value interface{}, err error)

func (*Memo) Invalidate

func (memo *Memo) Invalidate() bool

Invalidate resets the cache to nil if the memo's given cache duration has elapsed, and returns true if the cache was actually invalidated.

func (*Memo) Reset

func (memo *Memo) Reset()

Reset forcibly resets the cache to nil without checking if the cache duration has elapsed.

Jump to

Keyboard shortcuts

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