// Get returns setting value (possibly cached) for the given key.
//
// It will be deserialized into the supplied value. Caller is responsible
// to pass correct type and pass same type to all calls. If the setting is not
// set returns ErrNoSettings.
189824
func (s *Settings) Get(c context.Context, key string, value interface{}) error {
	bundle, err := s.values.Get(c, func(interface{}) (interface{}, time.Duration, error) {
		c, done := clock.WithTimeout(c, 15*time.Second) // retry for 15 sec total
		defer done()
		var bundle *Bundle
		var exp time.Duration
		err := retry.Retry(c, transient.Only(retry.Default), func() (err error) {
			c, done := clock.WithTimeout(c, 2*time.Second) // trigger a retry after 2 sec RPC timeout
			defer done()
			bundle, exp, err = s.storage.FetchAllSettings(c)
			return
		}, nil)
		if err != nil {
			return nil, 0, err
		}
		// Meaning of 0 in FetchAllSettings is different from how lazyslot
		// understands it.
		if exp == 0 {
			exp = lazyslot.ExpiresImmediately
		}
		return bundle, exp, nil
	})
	if err != nil {
		return err
	}
	return bundle.(*Bundle).get(key, value)
}
398268
func (s *Settings) Get(name string, def ...interface{}) interface{} {
	s.lock.Lock()
	defer s.lock.Unlock()
	if v, ok := s.data[name]; ok {
		return v
	} else if s.parent != nil {
		return s.parent.Settings().Get(name, def...)
	} else if len(def) > 0 {
		return def[0]
	}
	return nil
}
565953
func (args Args) Get(key string) []string {
	values := args.fields[key]
	if values == nil {
		return make([]string, 0)
	}
	slice := make([]string, 0, len(values))
	for key := range values {
		slice = append(slice, key)
	}
	return slice
}
1278301
func (h *applyHandler) Get(key string, args ...interface{}) (interface{}, error) {
	var err error
	if h.keyFunc != nil {
		key, err = h.keyFunc(key)
		if err != nil {
			return nil, err
		}
	}
	return h.handler.Get(key, args...)
}
658193
func (p *Parameters) Get(key string) (value []byte, ok bool) {
	for _, v := range p.data() {
		if string(v.key) == key {
			return v.value, true
		}
	}
	return nil, false
}
616508
func (c *Ctx) Get(key interface{}) (value interface{}, exists bool) {
	value = c.request.Context().Value(key)
	exists = value != nil
	return
}
728193
func (s *Server) Get(ctx context.Context, q *SettingsQuery) (*Settings, error) {
	argoCDSettings, err := s.mgr.GetSettings()
	if err != nil {
		return nil, err
	}

	overrides := make(map[string]*v1alpha1.ResourceOverride)
	for k := range argoCDSettings.ResourceOverrides {
		val := argoCDSettings.ResourceOverrides[k]
		overrides[k] = &val
	}
	set := Settings{
		URL:               argoCDSettings.URL,
		AppLabelKey:       argoCDSettings.GetAppInstanceLabelKey(),
		ResourceOverrides: overrides,
	}
	if argoCDSettings.DexConfig != "" {
		var cfg DexConfig
		err = yaml.Unmarshal([]byte(argoCDSettings.DexConfig), &cfg)
		if err == nil {
			set.DexConfig = &cfg
		}
	}
	if oidcConfig := argoCDSettings.OIDCConfig(); oidcConfig != nil {
		set.OIDCConfig = &OIDCConfig{
			Name:        oidcConfig.Name,
			Issuer:      oidcConfig.Issuer,
			ClientID:    oidcConfig.ClientID,
			CLIClientID: oidcConfig.CLIClientID,
		}
	}
	return &set, nil
}
429682
func (v *Values) Get(key Key) (value interface{}) {
	value, _ = v.GetOk(key)
	return value
}
759603
func (c *Cache) Get(key Key, data ...interface{}) (interface{}, error) {
	keyStr := key.String()

	f, ok := c.m.Load(keyStr)
	if ok {
		v, err := f.(future).Get()
		if err != nil {
			return nil, err
		}
		return c.value(v, first(data))
	}

	// The key wasn't found. Attempt to add one.
	newFuture := futurevalue.New(
		func() (interface{}, error) {
			if closed := atomic.LoadInt32(&c.closed); closed == 1 {
				return nil, errors.Errorf("%s - cache is closed", c.name)
			}
			return c.initializer(key, first(data))
		},
	)

	f, loaded := c.m.LoadOrStore(keyStr, newFuture)
	if loaded {
		// Another thread has added the key before us. Return the value.
		v, err := f.(future).Get()
		if err != nil {
			return nil, err
		}
		return c.value(v, first(data))
	}

	// We added the key. It must be initialized.
	value, err := newFuture.Initialize()
	if err != nil {
		// Failed. Delete the key.
		logger.Debugf("%s - Failed to initialize key [%s]: %s. Deleting key.", c.name, keyStr, err)
		c.m.Delete(keyStr)
		return nil, err
	}
	return c.value(value, first(data))
}
619375
func (mem *Memcache) Get(key string) interface{} {
	var err error
	var item *memcache.Item
	if item, err = mem.conn.Get(key); err != nil {
		return nil
	}
	var result interface{}
	if err = json.Unmarshal(item.Value, &result); err != nil {
		return nil
	}
	return result
}
534569
func (mc *Connection) Get(keys ...string) (results []cacheservice.Result, err error) {
	defer handleError(&err)
	results = mc.get("get", keys)
	return
}
1280023
func (c *Cache) Get(key string) (value interface{}, err error) {
	out := struct {
		Cache string      `json:"cache"`
		Key   string      `json:"key"`
		Value interface{} `json:"value"`
	}{}
	if err = c.caches(c.Name, "items", key).Req("GET", nil, &out); err == nil {
		value = out.Value
	}
	return
}
959307
func (r *Redis) Get(key string) (string, error) {
	return r.Client.Get(key).Result()
}
327063
func (j *Json) Get(key string) *Json {
	m, err := j.Map()
	if err == nil {
		if val, ok := m[key]; ok {
			return &Json{val}
		}
	}
	return &Json{nil}
}
614751
func (c *Cache) Get(key string) (resp []byte, ok bool) {
	var err error
	resp, err = c.db.Get([]byte(key), nil)
	if err != nil {
		return []byte{}, false
	}
	return resp, true
}
1364204
func (c *xContext) Get(key string, defaults ...interface{}) interface{} {
	return c.store.Get(key, defaults...)
}
306617
func (l *Language) Get(key string) interface{} {
	local := l.GetLocal(key)
	if local != nil {
		return local
	}
	return l.Cfg.Get(key)
}