refactor: add cluster configuration support to set db cache based on the cluster settings
This commit is contained in:
parent
d71849493b
commit
fcf43e1f79
|
@ -87,6 +87,11 @@ func (m *Manager) ConfigureProtocol(name string, cfg ProtocolConfig) error {
|
|||
return err
|
||||
}
|
||||
|
||||
err = m.maybeConfigureCluster()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
|
@ -206,6 +211,15 @@ func (m *Manager) maybeSave() error {
|
|||
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 {
|
||||
return m.root
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue