Documentation
¶
Index ¶
Constants ¶
View Source
const ( ActiveServer = RedisState(0) DownServer = RedisState(1) )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Cache ¶
type Cache struct {
*RedisManager
}
Cache
type Redis ¶
type Redis struct {
*redis.Client
State RedisState `json:"state"`
Options *redis.Options
}
func (*Redis) MarshalJSON ¶
type RedisManager ¶
type RedisManager struct {
// contains filtered or unexported fields
}
func NewRedisManager ¶
func NewRedisManager(conf *config.Config) (*RedisManager, error)
NewRedisManager 从配置初始化所有 redis 连接 配置了的 redis 必须连接成功(ping),否则返回错误(fail-fast); 完全没有 redis 配置时返回空 manager,不报错。
func (*RedisManager) Close ¶ added in v0.2.0
func (rm *RedisManager) Close() error
Close 关闭所有Redis连接
func (*RedisManager) Names ¶ added in v0.3.0
func (rm *RedisManager) Names() []string
Names 返回所有已初始化的 redis 配置名
type RedisState ¶
type RedisState int
Click to show internal directories.
Click to hide internal directories.