(dateRange?: DateRange, providerFilter?: string)
| 2237 | const sessionCache = new Map<string, { data: ProjectSummary[]; ts: number }>() |
| 2238 | |
| 2239 | function cacheKey(dateRange?: DateRange, providerFilter?: string): string { |
| 2240 | const s = dateRange ? `${dateRange.start.getTime()}:${dateRange.end.getTime()}` : 'none' |
| 2241 | // Include the Claude config-dir env so a config change in a long-lived |
| 2242 | // process (menubar / GNOME extension / test workers) does not return |
| 2243 | // stale data keyed under a previous configuration. |
| 2244 | const claudeEnv = (process.env['CLAUDE_CONFIG_DIRS'] ?? '') + '|' + (process.env['CLAUDE_CONFIG_DIR'] ?? '') |
| 2245 | // Proxy attribution (totalProxiedCostUSD) is computed live from proxyPaths and |
| 2246 | // then cached, so the key must change when that config changes. |
| 2247 | return `${s}:${providerFilter ?? 'all'}:${claudeEnv}:${getProxyPathsConfigHash()}` |
| 2248 | } |
| 2249 | |
| 2250 | export function clearSessionCache(): void { |
| 2251 | sessionCache.clear() |
no test coverage detected