Skip to content

Latest commit

 

History

History
33 lines (22 loc) · 978 Bytes

README.md

File metadata and controls

33 lines (22 loc) · 978 Bytes

go-memoizer

A simple thread-safe memoizer for Go using only the standard library.

Supports Go 1.18 and higher due to the use of generics.

Reference Linter Build status

func expensiveFunction() (*any, error) {
    // ...
}

var memoized = memoizer.New(expensiveFunction, 10*time.Second)

for i := 0; i < 50; i++ {
    value, err := memoized.Get()

    // ...
}

Installation

go get github.com/LightningDev1/go-memoizer

Usage

See config example for a complete example program.