@@ -19,7 +19,6 @@ import (
1919
2020 beegoCache "github.com/beego/beego/v2/client/cache"
2121 _ "github.com/beego/beego/v2/client/cache/memcache"
22- "github.com/beego/beego/v2/client/cache/redis"
2322 "github.com/beego/beego/v2/client/orm"
2423 "github.com/beego/beego/v2/core/logs"
2524 "github.com/beego/beego/v2/server/web"
@@ -138,6 +137,7 @@ func RegisterModel() {
138137 new (models.Comment ),
139138 new (models.WorkWeixinAccount ),
140139 new (models.DingTalkAccount ),
140+ new (models.ContentReverseIndex ),
141141 )
142142 gob .Register (models.Blog {})
143143 gob .Register (models.Document {})
@@ -425,9 +425,9 @@ func ResolveCommand(args []string) {
425425 RegisterCache ()
426426 RegisterModel ()
427427 RegisterLogger (conf .LogFile )
428+ models .InitializeMissingIndexes ()
428429
429430 ModifyPassword ()
430-
431431}
432432
433433// 注册缓存管道
@@ -469,14 +469,15 @@ func RegisterCache() {
469469 beegoCache .DefaultEvery = cacheInterval
470470 cache .Init (memory )
471471 } else if cacheProvider == "redis" {
472- //设置Redis前缀
473- if key := web .AppConfig .DefaultString ("cache_redis_prefix" , "" ); key != "" {
474- redis .DefaultKey = key
475- }
476472 var redisConfig struct {
477473 Conn string `json:"conn"`
478474 Password string `json:"password"`
479475 DbNum string `json:"dbNum"`
476+ Key string `json:"key"`
477+ }
478+ //设置Redis前缀
479+ if key := web .AppConfig .DefaultString ("cache_redis_prefix" , "" ); key != "" {
480+ redisConfig .Key = key // 设置Redis前缀,替代原来的 redis.DefaultKey
480481 }
481482 redisConfig .DbNum = "0"
482483 redisConfig .Conn = web .AppConfig .DefaultString ("cache_redis_host" , "" )
0 commit comments