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

Function writeExpectf

memcache/memcache.go:718–736  ·  view source on GitHub ↗
(rw *bufio.ReadWriter, expect []byte, format string, args ...interface{})

Source from the content-addressed store, hash-verified

716}
717
718func writeExpectf(rw *bufio.ReadWriter, expect []byte, format string, args ...interface{}) error {
719 line, err := writeReadLine(rw, format, args...)
720 if err != nil {
721 return err
722 }
723 switch {
724 case bytes.Equal(line, resultOK):
725 return nil
726 case bytes.Equal(line, expect):
727 return nil
728 case bytes.Equal(line, resultNotStored):
729 return ErrNotStored
730 case bytes.Equal(line, resultExists):
731 return ErrCASConflict
732 case bytes.Equal(line, resultNotFound):
733 return ErrCacheMiss
734 }
735 return fmt.Errorf("memcache: unexpected response line: %q", string(line))
736}
737
738// Delete deletes the item with the provided key. The error ErrCacheMiss is
739// returned if the item didn't already exist in the cache.

Callers 2

DeleteMethod · 0.85
DeleteAllMethod · 0.85

Calls 1

writeReadLineFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…