MCPcopy
hub / github.com/loong/go-concurrency-exercises / CreateSession

Method CreateSession

5-session-cleaner/main.go:46–57  ·  view source on GitHub ↗

CreateSession creates a new session and returns the sessionID

()

Source from the content-addressed store, hash-verified

44
45// CreateSession creates a new session and returns the sessionID
46func (m *SessionManager) CreateSession() (string, error) {
47 sessionID, err := MakeSessionID()
48 if err != nil {
49 return "", err
50 }
51
52 m.sessions[sessionID] = Session{
53 Data: make(map[string]interface{}),
54 }
55
56 return sessionID, nil
57}
58
59// ErrSessionNotFound returned when sessionID not listed in
60// SessionManager

Callers 4

mainFunction · 0.95

Calls 1

MakeSessionIDFunction · 0.85