MCPcopy Index your code
hub / github.com/FlowiseAI/Flowise / memoizeEnvConfig

Function memoizeEnvConfig

packages/components/src/tracingEnv.ts:25–33  ·  view source on GitHub ↗
(name: string, resolver: () => ICommonObject | undefined)

Source from the content-addressed store, hash-verified

23 */
24const tracingEnvConfigCache = new Map<string, { value: ICommonObject | undefined }>()
25const 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. */
36export const resetTracingEnvCache = (): void => {

Callers 1

tracingEnv.tsFile · 0.85

Calls 2

setMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected