Documentation
¶
Overview ¶
Package robot_redis 提供 Redis 连接抽象,支持集群与非集群模式。
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Config ¶
type Config struct {
Addrs []string `yaml:"addrs"` // Redis 地址列表(非集群只取第一个)
Password string `yaml:"password"` // 密码
ClusterMode bool `yaml:"cluster_mode"` // 是否集群模式
}
Config Redis 连接配置
func ParseConfig ¶
type RedisClient ¶
type RedisClient interface {
redis.SetCmdable
redis.HashCmdable
redis.SortedSetCmdable
redis.GenericCmdable
redis.StringCmdable
redis.ListCmdable
Close() error
}
统一的 Redis 客户端抽象
func NewClient ¶
func NewClient(cfg Config) (RedisClient, error)
NewClient 根据配置创建 Redis 客户端并进行 Ping 检测。
Click to show internal directories.
Click to hide internal directories.