(name: string, resolver: () => ICommonObject | undefined)
| 23 | */ |
| 24 | const tracingEnvConfigCache = new Map<string, { value: ICommonObject | undefined }>() |
| 25 | const memoizeEnvConfig = (name: string, resolver: () => ICommonObject | undefined): (() => ICommonObject | undefined) => { |
| 26 | return () => { |
| 27 | const cached = tracingEnvConfigCache.get(name) |
| 28 | if (cached) return cached.value |
| 29 | const value = resolver() |
| 30 | tracingEnvConfigCache.set(name, { value }) |
| 31 | return value |
| 32 | } |
| 33 | } |
| 34 | |
| 35 | /** @internal Test-only: drop cached env-var tracing configs so a subsequent call re-reads env. */ |
| 36 | export const resetTracingEnvCache = (): void => { |
no test coverage detected