// Stores the given item only if item.Casid matches casid for the given item
// on the server.
//
// Returns ErrCacheMiss if the server has no item with such a key.
// Returns ErrCasidMismatch if item on the server has other casid value.
Stores the given item only if item.Casid matches casid for the given item
on the server.

Returns ErrCacheMiss if the server has no item with such a key.
Returns ErrCasidMismatch if item on the server has other casid value.
// Stores the given item only if item . Casid matches casid for the given item // on the server . // // Returns ErrCacheMiss if the server has no item with such a key . // Returns ErrCasidMismatch if item on the server has other casid value .
func (c *Client) Cas(item *Item) error {
	if !validateKey(item.Key) {
		return ErrMalformedKey
	}
	if item.Value == nil {
		return ErrNilValue
	}
	var t taskCas
	t.item = item
	if err := c.do(&t); err != nil {
		return err
	}
	if t.notFound {
		return ErrCacheMiss
	}
	if t.casidMismatch {
		return ErrCasidMismatch
	}
	return nil
}
func ( c * Client ) Cas ( item * Item ) error { if ! validateKey ( item . Key ) { return ErrMalformedKey } if item . Value == nil { return ErrNilValue } var t taskCas t . item = item if err := c . do ( & t ) ; err != nil { return err } if t . notFound { return ErrCacheMiss } if t . casidMismatch { return ErrCasidMismatch } return nil }
Stores the given item only if item.Casid matches casid for the given item
on the server.
Stores the given item only if item . Casid matches casid for the given item on the server .