Skip to content
This repository has been archived by the owner on Jul 10, 2024. It is now read-only.

ketch-com/gocache-memoize

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

gocache-memoize

Memoization implemented using eko/gocache.

Installation

To begin working with the latest version of gocache-memoize, you can import the library in your project:

go get github.com/ketch-com/gocache-memoize

Usage

import (
	"github.com/eko/gocache/lib/v4/cache"
	"github.com/ketch-com/gocache-memoize"
)

cacheManager := cache.New[[]byte](...)

m := memoize.NewMemoizer(cacheManager)
value, err := m.Memoize(ctx, "key1", func(ctx context.Context) (any, error) {
	return "test", nil
})