refactor: add cluster configuration support to set db cache based on the cluster settings

This commit is contained in:
Derrick Hammer 2024-02-28 09:21:20 -05:00
parent d71849493b
commit fcf43e1f79
Signed by: pcfreak30
GPG Key ID: C997C339BE476FF2
1 changed files with 14 additions and 0 deletions

View File

@ -87,6 +87,11 @@ func (m *Manager) ConfigureProtocol(name string, cfg ProtocolConfig) error {
return err return err
} }
err = m.maybeConfigureCluster()
if err != nil {
return err
}
return nil return nil
} }
@ -206,6 +211,15 @@ func (m *Manager) maybeSave() error {
return nil return nil
} }
func (m *Manager) maybeConfigureCluster() error {
if m.root.Core.Clustered.Enabled {
m.root.Core.DB.Cache.Mode = "redis"
m.root.Core.DB.Cache.Options = m.root.Core.Clustered.Redis
}
return nil
}
func (m *Manager) Config() *Config { func (m *Manager) Config() *Config {
return m.root return m.root
} }