Passport/pkg/internal/cache/store.go

25 lines
417 B
Go
Raw Permalink Normal View History

2024-09-22 05:13:05 +00:00
package cache
import (
"github.com/dgraph-io/ristretto"
"github.com/eko/gocache/lib/v4/store"
ristrettoCache "github.com/eko/gocache/store/ristretto/v4"
)
var S store.StoreInterface
func NewStore() error {
2024-11-03 13:31:32 +00:00
ris, err := ristretto.NewCache(&ristretto.Config{
NumCounters: 1e7,
MaxCost: 1 << 27,
2024-09-22 05:13:05 +00:00
BufferItems: 64,
})
if err != nil {
return err
}
2024-11-03 13:31:32 +00:00
S = ristrettoCache.NewRistretto(ris)
2024-09-22 05:13:05 +00:00
return nil
}