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

Method CompareAndSwap

memcache/memcache.go:657–659  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

655// calls. ErrNotStored is returned if the value was evicted in between
656// the calls.
657func (c *Client) CompareAndSwap(item *Item) error {
658 return c.onItem(item, (*Client).cas)
659}
660
661func (c *Client) cas(rw *bufio.ReadWriter, item *Item) error {
662 return c.populateOne(rw, "cas", item)

Callers 1

testWithClientFunction · 0.80

Calls 1

onItemMethod · 0.95

Tested by 1

testWithClientFunction · 0.64