Function
getCachedProviderClient
(key: string, factory: () => T)
Source from the content-addressed store, hash-verified
| 20 | * making it the tenant boundary (clients are never shared across keys). |
| 21 | */ |
| 22 | export function getCachedProviderClient<T extends object>(key: string, factory: () => T): T { |
| 23 | const existing = clientCache.get(key) |
| 24 | if (existing) { |
| 25 | return existing as T |
| 26 | } |
| 27 | |
| 28 | const client = factory() |
| 29 | clientCache.set(key, client) |
| 30 | return client |
| 31 | } |
| 32 | |
| 33 | /** Clears the cache so tests asserting client construction start from a miss. */ |
| 34 | export function clearProviderClientCacheForTests(): void { |
Tested by
no test coverage detected