MCPcopy Create free account
hub / github.com/Effect-TS/effect / getOrElseMemoize

Method getOrElseMemoize

packages/effect/src/Layer.ts:445–457  ·  view source on GitHub ↗
(
    layer: Layer<ROut, E, RIn>,
    scope: Scope.Scope,
    build: (memoMap: MemoMap, scope: Scope.Scope) => Effect<Context.Context<ROut>, E, RIn>
  )

Source from the content-addressed store, hash-verified

443 }
444
445 getOrElseMemoize<RIn, E, ROut>(
446 layer: Layer<ROut, E, RIn>,
447 scope: Scope.Scope,
448 build: (memoMap: MemoMap, scope: Scope.Scope) => Effect<Context.Context<ROut>, E, RIn>
449 ): Effect<Context.Context<ROut>, E, RIn> {
450 return internalEffect.suspend(() => {
451 const existing = this.get(layer, scope)
452 if (existing) {
453 return existing
454 }
455 return memoMapBuild(this, layer, scope, build)
456 })
457 }
458}
459
460/**

Callers 1

fromBuildMemoFunction · 0.80

Calls 2

getMethod · 0.95
memoMapBuildFunction · 0.85

Tested by

no test coverage detected