// Set a key and 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
}
206982
func (s *RedisMapStore) Set(key string, value interface{}, properties ...string) error {
	key, vmap, err := s.prepare(key, value, properties...)
	if err != nil {
		return err
	}
	if len(vmap) == 0 {
		return nil
	}
	return s.client.HMSet(key, vmap).Err()
}
289624
func (etcdClient *SimpleEtcdClient) Set(key, value string) error {
	api := client.NewKeysAPI(etcdClient.etcd)
	_, err := api.Set(context.Background(), key, value, nil)
	return err
}
162378
func (m *SecureMap) Set(key, value interface{}) {

	if _, ok := m.data[key]; ok {
		return
	}

	m.lock.Lock()
	m.data[key] = value
	m.lock.Unlock()
}
1190514
func (s *storeImpl) Set(key string, val interface{}) {
	s.mutex.Lock()
	defer s.mutex.Unlock()
	s.objects[key] = object{contents: val}
}
1182794
func (cb *ConfigBackend) Set(key string, value string) (string, error) {
	resp, err := cb.etcdlib.Set(key, value, 0) // don't use TTLs
	if err != nil {
		return "", err
	}
	return resp.Node.Value, nil
}
1309609
func (r *Record) Set(key string, value interface{}) {
	r.Data[key] = value
}
604742
func (r *Response) Set(key, value string) {
	r.handlerHeader.Set(key, value)
}
4887
func (c *Controller) Set(key, val interface{}) {
	c.instance.StorageMu.Lock()
	c.instance.Storage[key] = val
	c.instance.StorageMu.Unlock()
}
1251284
func (v *Value) Set(key string) error {
	key = strings.TrimSpace(key)
	if len(key) == 0 {
		return fmt.Errorf("Cannot specify an empty tag.")
	}

	value := ""
	idx := strings.Index(key, "=")
	switch {
	case idx == -1:
		break

	case idx == 0:
		return fmt.Errorf("Cannot have tag with empty key.")

	case idx > 0:
		key, value = key[:idx], key[idx+1:]
	}

	// Add the entry to our tag map.
	if len(*v) > 0 {
		if _, ok := (*v)[key]; ok {
			return fmt.Errorf("The tag '%s' has already been defined.", key)
		}
	}

	// Record this tag; create a new Value, if necessary.
	if *v == nil {
		*v = make(Value)
	}
	(*v)[key] = value
	return nil
}
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
}
848408
func (r *Redis) Set(key string, value interface{}) error {
	return r.Client.Set(key, convertToBytes(value), 0).Err()
}
143659
func (t *TxStructure) Set(key []byte, value []byte) error {
	if t.readWriter == nil {
		return errWriteOnSnapshot
	}
	ek := t.encodeStringDataKey(key)
	return t.readWriter.Set(ek, value)
}
26981
func (s *Session) Set(key string, value interface{}) {
	s.set(key, value, false)
}
199477
func (fs *FileSessionStore) Set(key, value interface{}) {
	fs.lock.Lock()
	defer fs.lock.Unlock()
	fs.values[key] = value
}
1184022
func (c *LFUCache) Set(key, value interface{}) error {
	c.mu.Lock()
	defer c.mu.Unlock()
	_, err := c.set(key, value)
	return err
}
715593
func (st *MemSessionStore) Set(key, value interface{}) {
	st.lock.Lock()
	defer st.lock.Unlock()
	st.value[key] = value
}