增加了redis的数据库
This commit is contained in:
parent
737c0eb28f
commit
b1102bda0d
@ -25,6 +25,7 @@ redis:
|
|||||||
port: 30002
|
port: 30002
|
||||||
password: gdxz2022&dj.
|
password: gdxz2022&dj.
|
||||||
pool-size: 100
|
pool-size: 100
|
||||||
|
db: 1
|
||||||
|
|
||||||
# [jwt]
|
# [jwt]
|
||||||
jwt:
|
jwt:
|
||||||
|
|||||||
@ -5,4 +5,5 @@ type Redis struct {
|
|||||||
Port int `mapstructure:"port" json:"port" yaml:"port"` // 服务器端口
|
Port int `mapstructure:"port" json:"port" yaml:"port"` // 服务器端口
|
||||||
Password string `mapstructure:"password" json:"password" yaml:"password"` // 密码
|
Password string `mapstructure:"password" json:"password" yaml:"password"` // 密码
|
||||||
PoolSize int `mapstructure:"pool-size" json:"pool-size" yaml:"pool-size"` // 连接池大小
|
PoolSize int `mapstructure:"pool-size" json:"pool-size" yaml:"pool-size"` // 连接池大小
|
||||||
|
Db int `mapstructure:"db" json:"db" yaml:"db"` // 数据库
|
||||||
}
|
}
|
||||||
|
|||||||
@ -14,7 +14,7 @@ func Redis() {
|
|||||||
global.Redis = redis.NewClient(&redis.Options{
|
global.Redis = redis.NewClient(&redis.Options{
|
||||||
Addr: config.C.Redis.Host + ":" + strconv.Itoa(config.C.Redis.Port),
|
Addr: config.C.Redis.Host + ":" + strconv.Itoa(config.C.Redis.Port),
|
||||||
Password: config.C.Redis.Password, // no password set
|
Password: config.C.Redis.Password, // no password set
|
||||||
DB: 0, // use default DB
|
DB: config.C.Redis.Db, // use default DB
|
||||||
PoolSize: config.C.Redis.PoolSize,
|
PoolSize: config.C.Redis.PoolSize,
|
||||||
})
|
})
|
||||||
_, err := global.Redis.Ping(context.Background()).Result()
|
_, err := global.Redis.Ping(context.Background()).Result()
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user