MCPcopy Create free account
hub / github.com/chainreactors/EvilProxy / Get

Method Get

sdk/cliproxy/auth/session_cache.go:39–56  ·  view source on GitHub ↗

Get retrieves the auth ID bound to a session, if still valid. Does NOT refresh the TTL on access.

(sessionID string)

Source from the content-addressed store, hash-verified

37// Get retrieves the auth ID bound to a session, if still valid.
38// Does NOT refresh the TTL on access.
39func (c *SessionCache) Get(sessionID string) (string, bool) {
40 if sessionID == "" {
41 return "", false
42 }
43 c.mu.RLock()
44 entry, ok := c.entries[sessionID]
45 c.mu.RUnlock()
46 if !ok {
47 return "", false
48 }
49 if time.Now().After(entry.expiresAt) {
50 c.mu.Lock()
51 delete(c.entries, sessionID)
52 c.mu.Unlock()
53 return "", false
54 }
55 return entry.authID, true
56}
57
58// GetAndRefresh retrieves the auth ID bound to a session and refreshes TTL on hit.
59// This extends the binding lifetime for active sessions.

Calls

no outgoing calls