Skip to content

LightningDev1/go-memoizer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.