(sessionId: string, filePath: string)
| 128 | } |
| 129 | |
| 130 | export 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 | |
| 146 | export function invalidateSessionPathCache(sessionId: string): void { |
| 147 | const pathCache = getPathCache(); |
no test coverage detected