Skip to content

Commit

Permalink
add ManualConfigure parameter to cache config
Browse files Browse the repository at this point in the history
  • Loading branch information
wubin48435 committed Jul 2, 2024
1 parent d45ff8d commit dda2033
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion framework/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -501,7 +501,8 @@ type Config struct {
ConnMaxIdleTime string
}
Cache struct {
Enable bool
Enable bool
ManualConfigure bool
}
Prometheus struct {
Enable bool
Expand Down
2 changes: 1 addition & 1 deletion framework/database/database.go
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ func NewDb(conf config.Config) (db *gorm.DB) {
ConfigureMetrics(db, conf.Db.Prometheus.DBName, uint32(conf.Db.Prometheus.RefreshInterval),
nil, collectors...)
}
if conf.Db.Cache.Enable && stringutils.IsNotEmpty(conf.Cache.Stores) {
if conf.Db.Cache.Enable && stringutils.IsNotEmpty(conf.Cache.Stores) && !conf.Db.Cache.ManualConfigure {
ConfigureDBCache(db, cache.NewCacheManager(conf))
}
return
Expand Down

0 comments on commit dda2033

Please sign in to comment.