// NewMemcachedClient4T return a client that implements the text protocol. func NewMemcachedClient4T(c *config.Config) (*MemcachedClient4T, error) { if len(c.Servers) == 0 { return nil, fmt.Errorf("Memcached : Servers must not empty") } if c.InitConns <= 0 { c.InitConns = 15 } if c.NumberOfReplicas <= 0 { c.NumberOfReplicas = 20 } if c.RefreshHashIntervalInSecond <= 0 { c.RefreshHashIntervalInSecond = 10 } c.TextOrBinary = 0 p, err := pool.New(c) if err != nil { return nil, err } tpp := parse.NewTextProtocolParse(p, c) return &MemcachedClient4T{tpp}, nil }
func new() *parse.TextProtocolParse { c := config.New() c.Servers = []string{"127.0.0.1:11211"} p, _ := pool.New(c) return parse.NewTextProtocolParse(p, c) }
func createPool(t *testing.T) *pool.ConnectionPool { c := config.New() if c == nil { t.Error("new config error.") } c.Servers = servers p, err := pool.New(c) if err != nil { t.Error("new pool error.") } t.Logf("%+v\n", p) return p.(*pool.ConnectionPool) }