redis.go 581 字节
Newer Older
Y
Your Name 已提交
1
package redis_manager
E
eoLinker API Management 已提交
2

黄孟柱 已提交
3
import "github.com/go-redis/redis"
E
eoLinker API Management 已提交
4 5

const (
Y
Your Name 已提交
6 7
	//RedisModeCluster cluster模式
	RedisModeCluster = "cluster"
Y
Your Name 已提交
8 9 10

	//RedisModeSentinel sentinel模式
	RedisModeSentinel = "sentinel"
Y
Your Name 已提交
11 12
	//RedisModeStand stand模式
	RedisModeStand = "stand"
E
eoLinker API Management 已提交
13 14
)

Y
Your Name 已提交
15
//Redis redis接口
E
eoLinker API Management 已提交
16 17 18 19
type Redis interface {
	redis.Cmdable
	GetConfig() RedisConfig
	//Foreach(fn func(client *localRedis.Client) error) error
Y
Your Name 已提交
20
	Nodes() []string
E
eoLinker API Management 已提交
21 22
}

Y
Your Name 已提交
23
//RedisConfig redis配置
E
eoLinker API Management 已提交
24 25 26 27 28 29 30
type RedisConfig interface {
	GetMode() string
	GetAddrs() []string
	GetMasters() []string
	GetDbIndex() int
	GetPassword() string
}