🐎 加入缓存

This commit is contained in:
微凉
2020-12-29 13:37:58 +08:00
parent 02e665ae37
commit bf3f741b22
16 changed files with 270 additions and 138 deletions

15
bootstrap/cache.go Normal file
View File

@ -0,0 +1,15 @@
package bootstrap
import (
"github.com/Xhofe/alist/conf"
"github.com/patrickmn/go-cache"
log "github.com/sirupsen/logrus"
"time"
)
func InitCache() {
if conf.Conf.Cache.Enable {
log.Infof("初始化缓存...")
conf.Cache=cache.New(time.Duration(conf.Conf.Cache.Expiration)*time.Minute,time.Duration(conf.Conf.Cache.CleanupInterval)*time.Minute)
}
}