// Stores the given item only if the server doesn't already hold data
// under the item.Key.
//
// Returns ErrAlreadyExists error if the server already holds data under
// the item.Key.
Stores the given item only if the server doesn't already hold data
under the item.Key.

Returns ErrAlreadyExists error if the server already holds data under
the item.Key.
// Stores the given item only if the server doesn ' t already hold data // under the item . Key . // // Returns ErrAlreadyExists error if the server already holds data under // the item . Key .
func (c *Client) Add(item *Item) error {
	if !validateKey(item.Key) {
		return ErrMalformedKey
	}
	if item.Value == nil {
		return ErrNilValue
	}
	var t taskAdd
	t.item = item
	if err := c.do(&t); err != nil {
		return err
	}
	if t.notStored {
		return ErrAlreadyExists
	}
	return nil
}
func ( c * Client ) Add ( item * Item ) error { if ! validateKey ( item . Key ) { return ErrMalformedKey } if item . Value == nil { return ErrNilValue } var t taskAdd t . item = item if err := c . do ( & t ) ; err != nil { return err } if t . notStored { return ErrAlreadyExists } return nil }
Stores the given item only if the server doesn't already hold data
under the item.Key.
Stores the given item only if the server doesn ' t already hold data under the item . Key .