package redis import ( redis "github.com/alauda/go-redis-client" _ "github.com/petermattis/goid" ) type Client struct { *redis.Client addr string prefix string } func NewClient(addr, prefix string) (*Client, error) { opts := redis.Options{ Type: redis.ClientNormal, Hosts: []string{addr}, KeyPrefix: prefix, } client := redis.NewClient(opts) _, err := client.Ping().Result() if err != nil { return nil, err } c := &Client{ Client: client, addr: addr, prefix: prefix, } return c, nil }