Add cache into post filter by user context

This commit is contained in:
2024-12-09 22:38:44 +08:00
parent 39889fe43d
commit 03f72d548d
5 changed files with 520 additions and 29 deletions

24
pkg/internal/cache/store.go vendored Normal file
View File

@ -0,0 +1,24 @@
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 {
ris, err := ristretto.NewCache(&ristretto.Config{
NumCounters: 1e7,
MaxCost: 1 << 27,
BufferItems: 64,
})
if err != nil {
return err
}
S = ristrettoCache.NewRistretto(ris)
return nil
}