// GetAndSet atomically sets current value to the given value and returns the old value.
186783
func (ai *AtomicInt) GetAndSet(newValue int) int {
	res := int(atomic.SwapInt64(&ai.val, int64(newValue)))
	return res
}
1189262
func (entry *Entry) GetPermset() (*Permset, error) {
	var ps C.acl_permset_t
	rv, _ := C.acl_get_permset(entry.e, &ps)
	if rv < 0 {
		return nil, fmt.Errorf("unable to get permset")
	}
	return &Permset{ps}, nil
}
737437
func (p *JsonPairs) NukeAndSet(m map[string][]string) {
	swap := make(JsonPairs, 0)
	for _, j := range *p { //j is value
		exists := false
		for k, _ := range m { //k is key
			if strings.Compare(j.K, k) == 0 {
				exists = true
				break
			}
		}
		if !exists {
			swap = append(swap, j)
		}
	}
	for mkey, mvals := range m {
		for _, mval := range mvals {
			swap = append(swap, NewJsonPair(mkey, mval))
		}
	}
	*p = swap
}
1195621
func (c *Client) GetSet(key, value string) (string, error) {
	v, err := c.execWithKey(true, "GETSET", key, value)
	if err != nil {
		return "", err
	}
	return iface2str(v)
}
895049
func (db *RedisDB) ssetSet(key string, sset sortedSet) {
	db.keys[key] = "zset"
	db.keyVersion[key]++
	db.sortedsetKeys[key] = sset
}
289570
func (d *Deployment) GetUpdatedAt() Timestamp {
	if d == nil || d.UpdatedAt == nil {
		return Timestamp{}
	}
	return *d.UpdatedAt
}
131969
func (c *Client) GetSet(key string, value interface{}) (string, error) {
	var ret string
	err := c.command(
		&ret,
		[]byte(string("GETSET")),
		to.Bytes(key),
		to.Bytes(value),
	)
	return ret, err
}
267542
func (ai *AtomicInt) CompareAndSet(expect int, update int) bool {
	res := atomic.CompareAndSwapInt64(&ai.val, int64(expect), int64(update))
	return res
}
1113988
func parseSet(t *Tree, start Pos) (Node, error) {
	tok, err := t.expect(tokenName)
	if err != nil {
		return nil, err
	}
	_, err = t.expectValue(tokenPunctuation, "=")
	if err != nil {
		return nil, err
	}
	expr, err := t.parseExpr()
	if err != nil {
		return nil, err
	}
	_, err = t.expect(tokenTagClose)
	if err != nil {
		return nil, err
	}
	return NewSetNode(tok.value, expr, start), nil
}
79678
func (s *Set) GetValue(name interface{}) string {
	if opt := s.Lookup(name); opt != nil {
		return opt.String()
	}
	return ""
}
754067
func (a *App) GetUpdatedAt() time.Time {
	if a == nil || a.UpdatedAt == nil {
		return time.Time{}
	}
	return *a.UpdatedAt
}
1166486
func (s *Service) CompareAndSetPassword(ctx context.Context, name string, old string, new string) error {
	return s.kv.Update(ctx, func(tx Tx) error {
		if err := s.comparePassword(ctx, tx, name, old); err != nil {
			return err
		}
		return s.setPassword(ctx, tx, name, new)
	})
}
333733
func (p *PushEventRepository) GetUpdatedAt() Timestamp {
	if p == nil || p.UpdatedAt == nil {
		return Timestamp{}
	}
	return *p.UpdatedAt
}
392477
func (ec *Cache) GetOrSet(k string, newValue interface{}, size uint64, expire int32) (item interface{}) {
	ec.Lock()
	v, ok := ec.cache[k]
	if !ok || v.validUntil.Before(timeNow()) {
		ec.actualSet(k, newValue, size, expire)
		ec.Unlock()
		return newValue
	}
	ec.Unlock()
	return v.data
}
35572
func NewSet(key string, vals ...string) []*api.GenericResource {
	rs := make([]*api.GenericResource, 0, len(vals))

	for _, v := range vals {
		rs = append(rs, NewString(key, v))
	}

	return rs
}
85056
func NewSet(db *Database, id string) (*Set, error) {
	name := []byte(id)
	if err := (*bbolt.DB)(db).Update(func(tx *bbolt.Tx) error {
		if _, err := tx.CreateBucketIfNotExists(name); err != nil {
			return errors.New("Could not create bucket: " + err.Error())
		}
		return nil // Return from Update function
	}); err != nil {
		return nil, err
	}
	// Success
	return &Set{db, name}, nil
}
1302316
func (m *PostgresCreator) NewSet(id string) (pinterface.ISet, error) {
	return NewSet(m.host, id)
}