memo

package
v0.0.0-...-c4986e2 Latest Latest
Warning

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

Go to latest
Published: Aug 18, 2018 License: MIT Imports: 0 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(key string, done <-chan struct{}) (interface{}, error)

Func is the type of the function to memoize.

type Memo

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

Memo implements simple memorization of a function.

func New

func New(f Func) *Memo

New initialized memoizarion structure. Clients must call Close when done.

func (*Memo) Close

func (m *Memo) Close()

Close closes internal channel for requests.

func (*Memo) Get

func (m *Memo) Get(key string, done <-chan struct{}) (interface{}, error)

Get calculates new result for Func or returns one from the cache.

Jump to

Keyboard shortcuts

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