MCPcopy
hub / github.com/bradfitz/gomemcache / ping

Method ping

memcache/memcache.go:423–445  ·  view source on GitHub ↗

ping sends the version command to the given addr

(addr net.Addr)

Source from the content-addressed store, hash-verified

421
422// ping sends the version command to the given addr
423func (c *Client) ping(addr net.Addr) error {
424 return c.withAddrRw(addr, func(conn *conn) error {
425 rw := conn.rw
426 if _, err := fmt.Fprintf(rw, "version\r\n"); err != nil {
427 return err
428 }
429 if err := rw.Flush(); err != nil {
430 return err
431 }
432 line, err := rw.ReadSlice('\n')
433 if err != nil {
434 return err
435 }
436
437 switch {
438 case bytes.HasPrefix(line, versionPrefix):
439 break
440 default:
441 return fmt.Errorf("memcache: unexpected response line from ping: %q", string(line))
442 }
443 return nil
444 })
445}
446
447func (c *Client) touchFromAddr(addr net.Addr, keys []string, expiration int32) error {
448 return c.withAddrRw(addr, func(conn *conn) error {

Callers

nothing calls this directly

Calls 1

withAddrRwMethod · 0.95

Tested by

no test coverage detected