encapsulate Redis base function

This commit is contained in:
landaiqing
2024-08-06 13:17:03 +08:00
parent d0496b34f0
commit 86b907d4d0
15 changed files with 493 additions and 23 deletions

19
config/conf_redis.go Normal file
View File

@@ -0,0 +1,19 @@
package config
import "time"
type Redis struct {
Host string `yaml:"host"`
Port string `yaml:"port"`
Password string `yaml:"password"`
Db int `yaml:"db"`
MaxActive int `yaml:"max-active"`
MaxIdle int `yaml:"max-idle"`
MinIdle int `yaml:"min-idle"`
PoolSize int `yaml:"pool-size"`
PoolTimeout time.Duration `yaml:"pool-timeout"`
}
func (r *Redis) Addr() string {
return r.Host + ":" + r.Port
}