MCPcopy Create free account
hub / github.com/agegr/pi-web / cacheSessionPath

Function cacheSessionPath

lib/session-reader.ts:130–144  ·  view source on GitHub ↗
(sessionId: string, filePath: string)

Source from the content-addressed store, hash-verified

128}
129
130export function cacheSessionPath(sessionId: string, filePath: string): void {
131 const pathKey = normalizePath(filePath);
132 const pathCache = getPathCache();
133 const reverseCache = getPathToIdCache();
134 const previousPath = pathCache.get(sessionId);
135 const previousSessionId = reverseCache.get(pathKey);
136 if (previousPath && previousPath !== pathKey && reverseCache.get(previousPath) === sessionId) {
137 reverseCache.delete(previousPath);
138 }
139 if (previousSessionId && previousSessionId !== sessionId && pathCache.get(previousSessionId) === pathKey) {
140 pathCache.delete(previousSessionId);
141 }
142 pathCache.set(sessionId, pathKey);
143 reverseCache.set(pathKey, sessionId);
144}
145
146export function invalidateSessionPathCache(sessionId: string): void {
147 const pathCache = getPathCache();

Callers 5

sendMethod · 0.90
startRpcSessionFunction · 0.90
loadAllSessionsFunction · 0.85

Calls 2

getPathCacheFunction · 0.85
getPathToIdCacheFunction · 0.85

Tested by

no test coverage detected