package utils import ( "eta/eta_report/utils/redis" "time" ) type RedisClient interface { Get(key string) interface{} RedisBytes(key string) (data []byte, err error) RedisString(key string) (data string, err error) RedisInt(key string) (data int, err error) Put(key string, val interface{}, timeout time.Duration) error SetNX(key string, val interface{}, timeout time.Duration) bool Delete(key string) error IsExist(key string) bool LPush(key string, val interface{}) error Brpop(key string, callback func([]byte)) GetRedisTTL(key string) time.Duration Incrby(key string, num int) (interface{}, error) Do(commandName string, args ...interface{}) (reply interface{}, err error) } func initRedis(redisType string, conf string) (redisClient RedisClient, err error) { switch redisType { case "cluster": // 集群 redisClient, err = redis.InitClusterRedis(conf) default: // 默认走单机 redisClient, err = redis.InitStandaloneRedis(conf) } return }