// clearSession clear sessions.
774644
func clearSession(sid string, isForce bool) {
	var toRemove []string
	if sid == "all" {
		toRemove = getSessionIDs()
	} else {
		toRemove = append(toRemove, sid)
	}
	for _, sid := range toRemove {
		session, err := loadSessionV8(sid)
		if !isForce {
			fatalIf(err.Trace(sid), "Unable to load session `"+sid+"`. Use --force flag to remove obsolete session files.")

			fatalIf(session.Delete().Trace(sid), "Unable to remove session `"+sid+"`. Use --force flag to remove obsolete session files.")

			printMsg(clearSessionMessage{Status: "success", SessionID: sid})
			continue
		}
		// Forced removal of a session.
		forceClear(sid, session)
	}
	return
}
18786
func (s *AdminRespondToAuthChallengeOutput) SetSession(v string) *AdminRespondToAuthChallengeOutput {
	s.Session = &v
	return s
}
569380
func (c *Conn) TerminateSession(id string) {
	c.object.Call(dbusInterface+".TerminateSession", 0, id)
}
1156137
func (s *SessionStore) CloseSession(c context.Context, sessionID string) error {
	c = defaultNS(c)
	ent, err := s.fetchSession(c, sessionID)
	switch {
	case err != nil:
		return err
	case ent == nil:
		return nil
	default:
		ent.IsClosed = true
		ent.Closed = clock.Now(c).UTC()
		return transient.Tag.Apply(ds.Put(ds.WithoutTransaction(c), ent))
	}
}
1090735
func (s *InitiateAuthOutput) SetSession(v string) *InitiateAuthOutput {
	s.Session = &v
	return s
}
413489
func (s *Session) Clear() {
	s.Lock()
	defer s.Unlock()

	s.uid = ""
	s.data = map[string]interface{}{}
	s.updateEncodedData()
}
400358
func (pool *ObjectPool) Clear(ctx context.Context) {
	p, ok := pool.idleObjects.PollFirst().(*PooledObject)

	for ok {
		pool.destroy(ctx, p)
		p, ok = pool.idleObjects.PollFirst().(*PooledObject)
	}
}
1272284
func (db *Database) Clear(sid string) {
	db.Service.Update(func(tx *bolt.Tx) error {
		b := db.getBucketForSession(tx, sid)
		if b == nil {
			return nil
		}

		return b.ForEach(func(k []byte, v []byte) error {
			return b.Delete(k)
		})
	})
}
699005
func (db *TowerDB) DeleteSession(target wtdb.SessionID) error {
	db.mu.Lock()
	defer db.mu.Unlock()

	// Fail if the session doesn't exit.
	if _, ok := db.sessions[target]; !ok {
		return wtdb.ErrSessionNotFound
	}

	// Remove the target session.
	delete(db.sessions, target)

	// Remove the state updates for any blobs stored under the target
	// session identifier.
	for hint, sessionUpdates := range db.blobs {
		delete(sessionUpdates, target)

		// If this was the last state update, we can also remove the
		// hint that would map to an empty set.
		if len(sessionUpdates) == 0 {
			delete(db.blobs, hint)
		}
	}

	return nil
}
861204
func (l *Listener) closeSession(remote net.Addr) (ret bool) {
	l.sessionLock.Lock()
	defer l.sessionLock.Unlock()
	if _, ok := l.sessions[remote.String()]; ok {
		delete(l.sessions, remote.String())
		return true
	}
	return false
}
1244211
func (s *AssociateSoftwareTokenOutput) SetSession(v string) *AssociateSoftwareTokenOutput {
	s.Session = &v
	return s
}
1233401
func (s *AssociateSoftwareTokenInput) SetSession(v string) *AssociateSoftwareTokenInput {
	s.Session = &v
	return s
}
1264649
func (c *Crowd) InvalidateSession(token string) error {
	c.Client.Jar = c.cookies
	req, err := http.NewRequest("DELETE", c.url+"rest/usermanagement/1/session/"+token, nil)
	if err != nil {
		return err
	}
	req.SetBasicAuth(c.user, c.passwd)
	req.Header.Set("Accept", "application/xml")
	req.Header.Set("Content-Type", "application/xml")
	resp, err := c.Client.Do(req)
	if err != nil {
		return err
	}
	defer resp.Body.Close()
	if resp.StatusCode != 204 {
		return fmt.Errorf("request failed: %s", resp.Status)
	}

	return nil
}
359842
func (c *Context) ClearValue(key fmt.Stringer) {
	delete(c.values, key)
}
414569
func (s *Session) ClearCache() (err error) {
	if err = s.isActionable(); err != nil {
		return
	}
	_, err = synchronousEvent(s.c, s, s.w, Event{Name: EventNameSessionCmdClearCache, TargetID: s.id}, EventNameSessionEventClearedCache)
	return
}
974564
func forceClear(sid string, session *sessionV8) {
	if session != nil {
		if err := session.Delete().Trace(sid); err == nil {
			// Force unnecesseray removal successful.
			printMsg(clearSessionMessage{Status: "success", SessionID: sid})
			return
		}
	}
	// Remove obsolete session files.
	removeSessionFile(sid)
	removeSessionDataFile(sid)
	printMsg(clearSessionMessage{Status: "forced", SessionID: sid})
}
292696
func (b *databaseBackend) ClearConnection(name string) error {
	b.Lock()
	defer b.Unlock()
	return b.clearConnection(name)
}