alist/bootstrap/cache.go

19 lines
443 B
Go
Raw Normal View History

2021-10-27 14:45:36 +00:00
package bootstrap
import (
"github.com/Xhofe/alist/conf"
"github.com/eko/gocache/v2/cache"
"github.com/eko/gocache/v2/store"
2021-10-28 14:50:09 +00:00
goCache "github.com/patrickmn/go-cache"
2021-10-27 14:45:36 +00:00
log "github.com/sirupsen/logrus"
"time"
)
// InitCache init cache
func InitCache() {
log.Infof("init cache...")
2021-10-28 14:50:09 +00:00
goCacheClient := goCache.New(60*time.Minute, 120*time.Minute)
goCacheStore := store.NewGoCache(goCacheClient, nil)
conf.Cache = cache.New(goCacheStore)
}