MCPcopy Create free account
hub / github.com/TraderAlice/OpenAlice / loadCache

Function loadCache

src/services/auth/session-store.ts:52–66  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

50let writePromise: Promise<void> | null = null
51
52async function loadCache(): Promise<SessionsFile> {
53 if (cache) return cache
54 try {
55 const raw = await readFile(SESSIONS_FILE(), 'utf-8')
56 const parsed = JSON.parse(raw) as SessionsFile
57 if (parsed.version !== 1 || !Array.isArray(parsed.sessions)) {
58 cache = { version: 1, sessions: [] }
59 } else {
60 cache = parsed
61 }
62 } catch {
63 cache = { version: 1, sessions: [] }
64 }
65 return cache
66}
67
68async function flush(): Promise<void> {
69 if (!cache) return

Callers 5

createSessionFunction · 0.85
validateAndTouchFunction · 0.85
revokeSessionFunction · 0.85
revokeAllSessionsFunction · 0.85
listSessionsFunction · 0.85

Calls 2

SESSIONS_FILEFunction · 0.85
parseMethod · 0.80

Tested by

no test coverage detected