package redis import ( "errors" "fmt" "github.com/go-redis/redis" ) var StatRds *Manager type Manager struct { client *redis.Client options *redis.Options } // Redis 配置项 type Options = redis.Options func NewManagerWithUrl(url string, fn func(opt *Options)) (*Manager, error) { opts, err := redis.ParseURL(url) if err != nil { return nil, err } if opts == nil { err = errors.New(fmt.Sprintf("NewManagerWithUrl failed url %s", url)) return nil, err } if fn != nil { fn(opts) } return &Manager{options: opts}, nil }