// Set value to file session
199477
func (fs *FileSessionStore) Set(key, value interface{}) {
	fs.lock.Lock()
	defer fs.lock.Unlock()
	fs.values[key] = value
}
748646
func (p *parserMixin) FileVar(target **os.File) {
	p.SetValue(newFileValue(target, os.O_RDONLY, 0))
}
262181
func (s *VerifySoftwareTokenInput) SetSession(v string) *VerifySoftwareTokenInput {
	s.Session = &v
	return s
}
531610
func (db *Database) Set(sid string, lifetime sessions.LifeTime, key string, value interface{}, immutable bool) {
	valueBytes, err := sessions.DefaultTranscoder.Marshal(value)
	if err != nil {
		golog.Error(err)
		return
	}

	err = db.Service.Update(func(txn *badger.Txn) error {
		dur := lifetime.DurationUntilExpiration()
		return txn.SetWithTTL(makeKey(sid, key), valueBytes, dur)
	})

	if err != nil {
		golog.Error(err)
	}
}
227370
func (s *HeaderStorer) SetValueForSessionName(w http.ResponseWriter, name, value string, options *sessions.Options) error {
	var newHeaderMap map[string]string

	// try to fetch an existing headerMap to we can append our values
	headerBase64Encoded := w.Header().Get(s.HeaderFieldName)
	if headerBase64Encoded != "" {
		currentHeaderMap, err := s.headerToMap(headerBase64Encoded)
		if err != nil {
			return err
		}
		// we found old values. Prepare newHeaderMap, so we can add/update values.
		newHeaderMap = currentHeaderMap
	} else {
		// no header found. add a new one.
		newHeaderMap = make(map[string]string)
	}

	// add/update value to map.
	newHeaderMap[name] = value

	// encode to base64 string
	newHeaderEncoded, err := s.mapToHeader(newHeaderMap)
	if err != nil {
		return err
	}
	// add/replace current header
	w.Header().Set(s.HeaderFieldName, newHeaderEncoded)
	return nil
}
1293978
func (p *PEMFile) Set(value string) error {
	contents, err := ioutil.ReadFile(value)
	if err != nil {
		return err
	}
	if pemBlock, _ := pem.Decode(contents); pemBlock == nil {
		return errors.New("file contents must be in PEM format")
	}
	p.contents, p.path = string(contents), value
	return nil
}
1090735
func (s *InitiateAuthOutput) SetSession(v string) *InitiateAuthOutput {
	s.Session = &v
	return s
}
471028
func (s *AdminInitiateAuthOutput) SetSession(v string) *AdminInitiateAuthOutput {
	s.Session = &v
	return s
}
7876
func (s *RemoteStore) Set(fileName string, data []byte) error {
	sm := &SetMsg{
		FileName: fileName,
		Data:     data,
	}
	ctx, cancel := s.getContext()
	defer cancel()
	_, err := s.client.Set(ctx, sm)
	return err
}
889850
func (p *PollSet) File(f *os.File, events EventSet) (index int) {
	return p.Fd(f.Fd(), events)
}
642043
func (ssp *SharedStoragePerm) SetAll(value bool) {
	ssp.Access = value
	ssp.Create = value
	ssp.Delete = value
	ssp.ManageAttachedServers = value
	ssp.Resize = value
	ssp.SetDescription = value
	ssp.SetName = value
	ssp.Show = value
}
1233401
func (s *AssociateSoftwareTokenInput) SetSession(v string) *AssociateSoftwareTokenInput {
	s.Session = &v
	return s
}
185700
func (tc *TiDBContext) Value(key fmt.Stringer) interface{} {
	return tc.session.Value(key)
}
843065
func (c *Context) SetSession(session Session, login bool) {
	session.UserAgent = c.req.UserAgent()
	session.IpAddress = strings.Split(c.req.RemoteAddr, ":")[0]
	session.LastActiveTime = time.Now()
	session.CallCount++

	c.svc.sm.sessions[session.Key] = session
	c.Session = &session

	if login {
		http.SetCookie(c.res, &http.Cookie{
			Name:  soap.SessionCookieName,
			Value: session.Key,
		})

		c.postEvent(&types.UserLoginSessionEvent{
			SessionId: session.Key,
			IpAddress: session.IpAddress,
			UserAgent: session.UserAgent,
			Locale:    session.Locale,
		})
	}
}
893738
func (this *MemoryStore) Set(sess *Session) error {
	this.l.Lock()
	defer this.l.Unlock()
	this.m[sess.ID()] = sess
	if sess.IsNew() {
		// Since the memory store doesn't marshal to a string without the isNew, if it is left
		// to true, it will stay true forever.
		sess.isNew = false
		// Expire in the given time. If the maxAge is 0 (which means browser-session lifetime),
		// expire in a reasonable delay, 2 days. The weird case of a negative maxAge will
		// cause the immediate Delete call.
		wait := sess.MaxAge()
		if wait == 0 {
			wait = 2 * 24 * time.Hour
		}
		go func() {
			// Clear the session after the specified delay
			<-time.After(wait)
			this.Delete(sess.ID())
		}()
	}
	return nil
}
673536
func (c *fileCache) Set(key string, data []byte) error {
	err := os.MkdirAll(c.dirname, 0700)
	if err != nil {
		return err
	}
	return ioutil.WriteFile(c.filename(key), data, 0644)
}
1319975
func (s *StorageOverseer) Set(w http.ResponseWriter, r *http.Request, value string) error {
	// Reuse the existing cookie ID if it exists
	sessID, _ := s.options.getCookieValue(w, r)

	if len(sessID) == 0 {
		sessID = uuid.NewV4().String()
	}

	err := s.Storer.Set(sessID, value)
	if err != nil {
		return errors.Wrap(err, "unable to set session value")
	}

	w.(cookieWriter).SetCookie(s.options.makeCookie(sessID))

	return nil
}