William Petit
f37425018b
All checks were successful
Cadoles/bouncer/pipeline/head This commit looks good
34 lines
1.1 KiB
Go
34 lines
1.1 KiB
Go
package config
|
|
|
|
import "time"
|
|
|
|
const (
|
|
RedisModeSimple = "simple"
|
|
RedisModeSentinel = "sentinel"
|
|
RedisModeCluster = "cluster"
|
|
)
|
|
|
|
type RedisConfig struct {
|
|
Adresses InterpolatedStringSlice `yaml:"addresses"`
|
|
Master InterpolatedString `yaml:"master"`
|
|
ReadTimeout InterpolatedDuration `yaml:"readTimeout"`
|
|
WriteTimeout InterpolatedDuration `yaml:"writeTimeout"`
|
|
DialTimeout InterpolatedDuration `yaml:"dialTimeout"`
|
|
LockMaxRetries InterpolatedInt `yaml:"lockMaxRetries"`
|
|
MaxRetries InterpolatedInt `yaml:"maxRetries"`
|
|
PingInterval InterpolatedDuration `yaml:"pingInterval"`
|
|
}
|
|
|
|
func NewDefaultRedisConfig() RedisConfig {
|
|
return RedisConfig{
|
|
Adresses: InterpolatedStringSlice{"localhost:6379"},
|
|
Master: "",
|
|
ReadTimeout: InterpolatedDuration(30 * time.Second),
|
|
WriteTimeout: InterpolatedDuration(30 * time.Second),
|
|
DialTimeout: InterpolatedDuration(30 * time.Second),
|
|
LockMaxRetries: 10,
|
|
MaxRetries: 3,
|
|
PingInterval: InterpolatedDuration(30 * time.Second),
|
|
}
|
|
}
|