github.com/go-redis/cache包中
ring := redis.NewRing(&redis.RingOptions{
Addrs: map[string]string{
"server1": ":6379",
"server2": ":6380",
},
})
codec := &cache.Codec{
Redis: ring,
Marshal: func(v interface{}) ([]byte, error) {
return msgpack.Marshal(v)
},
Unmarshal: func(b []byte, v interface{}) error {
return msgpack.Unmarshal(b, v)
},
}
其中ring的类型是*Ring,而Codec结构中的Redis类型是rediser,上面的初始化有点看不懂,请指教