fix: cache init after config

This commit is contained in:
krau
2025-06-20 21:27:45 +08:00
parent 758564d436
commit 88128ecac2
2 changed files with 6 additions and 1 deletions

View File

@@ -11,7 +11,10 @@ import (
var cache *ristretto.Cache[string, any]
func init() {
func Init() {
if cache != nil {
panic("cache already initialized")
}
c, err := ristretto.NewCache(&ristretto.Config[string, any]{
NumCounters: config.Cfg.Cache.NumCounters,
MaxCost: config.Cfg.Cache.MaxCost,