ali path and link

This commit is contained in:
微凉
2021-10-28 22:50:09 +08:00
parent 98f7dffed9
commit 0a50fbd080
13 changed files with 207 additions and 41 deletions

View File

@ -2,9 +2,9 @@ package bootstrap
import (
"github.com/Xhofe/alist/conf"
"github.com/allegro/bigcache/v3"
"github.com/eko/gocache/v2/cache"
"github.com/eko/gocache/v2/store"
goCache "github.com/patrickmn/go-cache"
log "github.com/sirupsen/logrus"
"time"
)
@ -12,9 +12,7 @@ import (
// InitCache init cache
func InitCache() {
log.Infof("init cache...")
bigCacheConfig := bigcache.DefaultConfig(60 * time.Minute)
bigCacheConfig.HardMaxCacheSize = 512
bigCacheClient, _ := bigcache.NewBigCache(bigCacheConfig)
bigCacheStore := store.NewBigcache(bigCacheClient, nil)
conf.Cache = cache.New(bigCacheStore)
}
goCacheClient := goCache.New(60*time.Minute, 120*time.Minute)
goCacheStore := store.NewGoCache(goCacheClient, nil)
conf.Cache = cache.New(goCacheStore)
}

View File

@ -67,7 +67,7 @@ func InitModel() {
log.Fatalf("not supported database type: %s", config.Type)
}
log.Infof("auto migrate model")
err := conf.DB.AutoMigrate(&model.SettingItem{}, &model.Account{})
err := conf.DB.AutoMigrate(&model.SettingItem{}, &model.Account{},&model.Meta{})
if err != nil {
log.Fatalf("failed to auto migrate")
}
@ -87,7 +87,7 @@ func initAccounts() {
model.RegisterAccount(account)
driver, ok := drivers.GetDriver(account.Type)
if !ok {
log.Error("no [%s] driver", driver)
log.Errorf("no [%s] driver", driver)
} else {
err := driver.Save(&account, nil)
if err != nil {