Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type IClient ¶
type IClient interface {
redis.Cmdable
Init(...Option) error
Start() error
UnInit() error
IsValid() bool
Subscribe(ctx context.Context, channels ...string) *redis.PubSub
}
IClient redis 客户端接口包装,统一 client 和 cluster client 便于使用
func NewClusterClient ¶
type Options ¶
type Options struct {
// AddrHosts 集群节点 非集群模式配置一个 集群模式为一组, ip:port
AddrHosts []string `yaml:"addr_hosts"`
//UserName 鉴权使用的用户名
UserName string `yaml:"user_name"`
//Password 鉴权
Password string `yaml:"password"`
// DB 控制选择的数据库 默认 0
DB int `yaml:"db"`
// PoolSize 控制与redis 连接的最大连接数 默认为10
PoolSize int `yaml:"pool_size"`
// ReadOnly slave 节点启用 read-only 命令 集群模式生效
ReadOnly bool `yaml:"read_only"`
}
Options redis 配置
Click to show internal directories.
Click to hide internal directories.