CompareAndSwap writes the given item that was previously returned by Get, if the value was neither modified or evicted between the Get and the CompareAndSwap calls. The item's Key should not change between calls but all other item fields may differ. ErrCASConflict is returned if the value was modifi
(item *Item)
| 655 | // calls. ErrNotStored is returned if the value was evicted in between |
| 656 | // the calls. |
| 657 | func (c *Client) CompareAndSwap(item *Item) error { |
| 658 | return c.onItem(item, (*Client).cas) |
| 659 | } |
| 660 | |
| 661 | func (c *Client) cas(rw *bufio.ReadWriter, item *Item) error { |
| 662 | return c.populateOne(rw, "cas", item) |