(rw *bufio.ReadWriter, expect []byte, format string, args ...interface{})
| 716 | } |
| 717 | |
| 718 | func 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. |
no test coverage detected
searching dependent graphs…