Esempio n. 1
0
func NewKV(opts ...kv.Option) kv.KV {
	var options kv.Options
	for _, o := range opts {
		o(&options)
	}

	if len(options.Servers) == 0 {
		options.Servers = []string{"127.0.0.1:11211"}
	}

	return &mkv{
		Client: mc.New(options.Servers...),
	}
}
Esempio n. 2
0
func NewKV(opts ...kv.Option) kv.KV {
	var options kv.Options
	for _, o := range opts {
		o(&options)
	}

	if len(options.Servers) == 0 {
		options.Servers = []string{"127.0.0.1:6379"}
	}

	return &rkv{
		Client: redis.NewClient(&redis.Options{
			Addr:     options.Servers[0],
			Password: "", // no password set
			DB:       0,  // use default DB
		}),
	}
}