// Set a key and value
188283
func (rkv *KeyValue) Set(key, value string) error {
	conn := rkv.pool.Get(rkv.dbindex)
	_, err := conn.Do("SET", rkv.id+":"+key, value)
	return err
}
633294
func (k *Store) Set(key string, value interface{}) {
	k.mu.Lock()
	defer k.mu.Unlock()

	k.db[key] = value
	k.logChange(setOperation, key, value)
}
912247
func Set(key string, value interface{}, args ...interface{}) error {
	return std.Set(key, value, args...)
}
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})
}
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
}
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
}
230343
func (h *envHandler) Set(key string, value interface{}, args ...interface{}) error {
	if len(args) != 0 {
		return cfg.ErrArgsNotSupported
	}
	sval, err := cfg.ToString(value)
	if err != nil {
		return cfg.ErrBadType
	}

	err = os.Setenv(key, sval)
	if err != nil {
		return cfg.ErrKeyNotSet
	}

	return nil
}
99591
func (p *Params) Set(key, value string) {
	if len(key) == 0 {
		return
	}
	if key[0] != ':' && key[0] != '*' {
		key = ":" + key
	}

	for i, v := range *p {
		if v.Name == key {
			(*p)[i].Value = value
			return
		}
	}

	*p = append(*p, param{key, value})
}
192554
func (c *Ctx) Set(key interface{}, value interface{}) {
	c.request = c.request.WithContext(context.WithValue(c.request.Context(), key, value))
}
618726
func (v *Var) SetKey(value string) {
	// src := []byte(value)
	// regex := regexp.MustCompile("[0-9A-Za-z]+")
	// chunks := regex.FindAll(src, -1)
	// for i, val := range chunks {
	//
	// }
	v.Key = strings.ToUpper(value)
}
283610
func (hm *HashMap) Set(key Hashable, value interface{}) {
	(*hm).keys[key.Hash()] = key
	(*hm).values[key.Hash()] = value
}
5950
func (m *Map) Set(k KeyType, v ValueType) {
	m.set(k, v, mapKeyOptions{
		copyKey:     true,
		finalizeKey: m.finalize != nil,
	})
}
1298680
func (app *App) Set(key, val interface{}) *App {
	if k, ok := key.(appSetting); ok {
		switch key {
		case SetBodyParser:
			if bodyParser, ok := val.(BodyParser); !ok {
				panic(Err.WithMsg("SetBodyParser setting must implemented `gear.BodyParser` interface"))
			} else {
				app.bodyParser = bodyParser
			}
		case SetURLParser:
			if urlParser, ok := val.(URLParser); !ok {
				panic(Err.WithMsg("SetURLParser setting must implemented `gear.URLParser` interface"))
			} else {
				app.urlParser = urlParser
			}
		case SetCompress:
			if compress, ok := val.(Compressible); !ok {
				panic(Err.WithMsg("SetCompress setting must implemented `gear.Compressible` interface"))
			} else {
				app.compress = compress
			}
		case SetKeys:
			if keys, ok := val.([]string); !ok {
				panic(Err.WithMsg("SetKeys setting must be `[]string`"))
			} else {
				app.keys = keys
			}
		case SetLogger:
			if logger, ok := val.(*log.Logger); !ok {
				panic(Err.WithMsg("SetLogger setting must be `*log.Logger` instance"))
			} else {
				app.logger = logger
			}
		case SetParseError:
			if parseError, ok := val.(func(err error) HTTPError); !ok {
				panic(Err.WithMsg("SetParseError setting must be `func(err error) HTTPError`"))
			} else {
				app.parseError = parseError
			}
		case SetOnError:
			if onerror, ok := val.(func(ctx *Context, err HTTPError)); !ok {
				panic(Err.WithMsg("SetOnError setting must be `func(ctx *Context, err HTTPError)`"))
			} else {
				app.onerror = onerror
			}
		case SetSender:
			if sender, ok := val.(Sender); !ok {
				panic(Err.WithMsg("SetSender setting must implemented `gear.Sender` interface"))
			} else {
				app.sender = sender
			}
		case SetRenderer:
			if renderer, ok := val.(Renderer); !ok {
				panic(Err.WithMsg("SetRenderer setting must implemented `gear.Renderer` interface"))
			} else {
				app.renderer = renderer
			}
		case SetTimeout:
			if timeout, ok := val.(time.Duration); !ok {
				panic(Err.WithMsg("SetTimeout setting must be `time.Duration` instance"))
			} else {
				app.timeout = timeout
			}
		case SetWithContext:
			if withContext, ok := val.(func(*http.Request) context.Context); !ok {
				panic(Err.WithMsg("SetWithContext setting must be `func(*http.Request) context.Context`"))
			} else {
				app.withContext = withContext
			}
		case SetEnv:
			if _, ok := val.(string); !ok {
				panic(Err.WithMsg("SetEnv setting must be `string`"))
			}
		case SetServerName:
			if name, ok := val.(string); !ok {
				panic(Err.WithMsg("SetServerName setting must be `string`"))
			} else {
				app.serverName = name
			}
		case SetTrustedProxy:
			if _, ok := val.(bool); !ok {
				panic(Err.WithMsg("SetTrustedProxy setting must be `bool`"))
			}
		}
		app.settings[k] = val
		return app
	}
	app.settings[key] = val
	return app
}
680981
func (h *mapHandler) Set(key string, value interface{}, args ...interface{}) error {
	if len(args) != 0 {
		return cfg.ErrArgsNotSupported
	}
	h.values[key] = value
	return nil
}
802362
func (s *Settings) Set(key string, value interface{}) {
	s.core[key] = value
}
47684
func (db *CLevelDB) Set(key []byte, value []byte) {
	key = nonNilBytes(key)
	value = nonNilBytes(value)
	err := db.db.Put(db.wo, key, value)
	if err != nil {
		panic(err)
	}
}
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
}