// Set is used to store a new key/value pair using the
// context contained on this Ctx.
// It is a shortcut for context.WithValue(..., ...)
192554
func (c *Ctx) Set(key interface{}, value interface{}) {
	c.request = c.request.WithContext(context.WithValue(c.request.Context(), key, value))
}
422897
func (kv *KeyValue) Set(key, value string) error {
	if !kv.host.rawUTF8 {
		Encode(&value)
	}
	if _, err := kv.Get(key); err != nil {
		// Key does not exist, create it
		_, err = kv.host.db.Exec("INSERT INTO "+kv.table+" ("+keyCol+", "+valCol+") VALUES (?, ?)", key, value)
		return err
	}
	// Key exists, update the value
	_, err := kv.host.db.Exec("UPDATE "+kv.table+" SET "+valCol+" = ? WHERE "+keyCol+" = ?", value, key)
	return err
}
820135
func (c *Cache) Set(key, value string) bool {
	c.mu.Lock()
	defer c.mu.Unlock()

	// If already present, move to front of queue and restart the clock
	// (no need to update map as we're modifying the entry it already contains)
	if ee, ok := c.cache[key]; ok {
		c.ll.MoveToFront(ee)
		ent := ee.Value.(*entry)
		ent.value = value
		ent.expiration = c.newExpiration()
		return false
	}

	// If not present, add to cache and queue
	ele := c.ll.PushFront(&entry{key, value, c.newExpiration()})
	c.cache[key] = ele

	if c.ll.Len() > c.maxEntries {
		c.removeOldest()
	}
	return true
}
531540
func (c *xContext) Set(key string, val interface{}) {
	c.store.Set(key, val)
}
981385
func (f *fileStorage) Set(key string, value []byte) error {
	file, err := f.fileForWrite(key)

	if err != nil {
		return err
	}

	defer file.Close()

	_, err = file.Write(value)
	return err
}
1369810
func (c *Cache) Set(key string, value interface{}, size int64) {
	c.Lock()
	defer c.Unlock()

	var it *Item
	elem, ok := c.m[key]
	if ok {
		// Element exists, push it to front,
		// and then update value etc.
		it = elem.Value.(*Item)
		c.size -= it.Size
		c.l.MoveToFront(elem)
	} else {
		// Insert new element.
		it = &Item{Key: key}
		elem = c.l.PushFront(it)
		c.m[key] = elem
	}
	// Set or update item content.
	it.Value = value
	it.Size = size
	if it.Size < 0 {
		panic("cache: value has negative size")
	}
	it.ModTime = time.Now()
	it.AccessTime = it.ModTime

	// Update cache size.
	if it.Size >= math.MaxInt64-c.size {
		panic("cache: value size is too big")
	}
	c.size += it.Size

	c.enforceCapacity()
}
1349580
func (r *ConnectionValues) Set(key string, value interface{}) {
	args := *r
	n := len(args)
	for i := 0; i < n; i++ {
		kv := &args[i]
		if string(kv.key) == key {
			kv.value = value
			return
		}
	}

	c := cap(args)
	if c > n {
		args = args[:n+1]
		kv := &args[n]
		kv.key = append(kv.key[:0], key...)
		kv.value = value
		*r = args
		return
	}

	kv := connectionValue{}
	kv.key = append(kv.key[:0], key...)
	kv.value = value
	*r = append(args, kv)
}
516320
func (h Hash) Set(key string, value interface{}) Hash {
	h[key] = Value(valueToBytes(value))
	return h
}
312712
func (s setMap) Set(key string, value interface{}) {
	if reflect.ValueOf(value).IsNil() {
		return
	}

	s[key] = value
}
810900
func (env *Env) Set(key, value string) {
	*env = append(*env, key+"="+value)
}
1087618
func (p *Parameters) Set(key, value []byte) {
	p.bytes += len(key) + len(value)

	if p.pos < len(p.arr) {
		p.arr[p.pos] = pair{key, value}
		p.pos++
		return
	}

	if p.dyn == nil {
		p.dyn = make([]pair, len(p.arr), len(p.arr)+1)
		copy(p.dyn, p.arr[:])
	}
	p.dyn = append(p.dyn, pair{key, value})
}
512061
func (s Session) Set(key string, value interface{}) error {
	if value == nil {
		s.Del(key)
		return nil
	}

	s[key] = value
	return nil
}
940829
func (c *Ctx) Set(key interface{}, value interface{}) {
	c.netContext = context.WithValue(c.netContext, key, value)
}
921464
func (s *StringValue) Set(val string) error {
	*s = StringValue(val)
	return nil
}
1301299
func (kv *KeyValSlice) Set(v string) error {
	if len(*kv) == 0 {
		*kv = make([]map[string]string, 0)
	}
	var i KeyVal
	if err := i.Set(v); err != nil {
		return trace.Wrap(err)
	}
	*kv = append(*kv, i)
	return nil
}
714880
func (s *PostgresStore) Set(key, value interface{}) error {
	s.lock.Lock()
	defer s.lock.Unlock()

	s.data[key] = value
	return nil
}
1040626
func (c standardConfigManager) Set(key string, value []byte) error {
	err := c.store.Set(key, value)
	return err
}