31 lines
776 B
Go
31 lines
776 B
Go
package config
|
|
|
|
// RedisConf redis配置
|
|
type RedisConf struct {
|
|
Host string `yaml:"host"`
|
|
Port int `yaml:"port"`
|
|
Password string `yaml:"password"`
|
|
DB int `yaml:"db"`
|
|
MaxPoolSize int `yaml:"max_pool_size"`
|
|
MaxConnTimeout int `yaml:"max_conn_timeout"`
|
|
IdleTimeout int `yaml:"idle_timeout"`
|
|
ReadTimeout int `yaml:"read_timeout"`
|
|
WriteTimeout int `yaml:"write_timeout"`
|
|
}
|
|
|
|
// NewRedisConf with default value
|
|
func NewRedisConf() *RedisConf {
|
|
// only for development
|
|
return &RedisConf{
|
|
Host: "127.0.0.1",
|
|
Port: 6379,
|
|
Password: "",
|
|
DB: 0,
|
|
MaxPoolSize: 100,
|
|
MaxConnTimeout: 6,
|
|
IdleTimeout: 600,
|
|
ReadTimeout: 10,
|
|
WriteTimeout: 10,
|
|
}
|
|
}
|