MCPcopy Index your code
hub / github.com/CodisLabs/codis / NewClient

Function NewClient

pkg/utils/redis/client.go:35–48  ·  view source on GitHub ↗
(addr string, auth string, timeout time.Duration)

Source from the content-addressed store, hash-verified

33}
34
35func NewClient(addr string, auth string, timeout time.Duration) (*Client, error) {
36 c, err := redigo.Dial("tcp", addr, []redigo.DialOption{
37 redigo.DialConnectTimeout(math2.MinDuration(time.Second, timeout)),
38 redigo.DialPassword(auth),
39 redigo.DialReadTimeout(timeout), redigo.DialWriteTimeout(timeout),
40 }...)
41 if err != nil {
42 return nil, errors.Trace(err)
43 }
44 return &Client{
45 conn: c, Addr: addr, Auth: auth,
46 LastUse: time.Now(), Timeout: timeout,
47 }, nil
48}
49
50func (c *Client) Close() error {
51 return c.conn.Close()

Callers 3

NewClientNoAuthFunction · 0.70
GetClientMethod · 0.70
getSlowMethod · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected