What problem does it solve?
Effect Layer memoization can lead to unintended sharing across layer compositions. This guide explains identity-based caching, how to escape it with Layer.fresh, and how to control memoization using Layer.memoize and ManagedRuntime to ensure predictable test and runtime behavior.
Core Features & Use Cases
- Identity-based memoization ensures a single instance per layer reference within a build.
- Layer.fresh escapes memoization, enabling multiple independent instances when needed.
- Layer.memoize enables lazy construction with deterministic caching within a scope.
- ManagedRuntime allows sharing or isolating memoization across runs for stable tests and production workflows.
- Patterns for testing describe per-block isolation via it.layer and shared infrastructure via globalSetup.
Quick Start
Apply Layer.merge with your base layers and use Layer.fresh only when you need separate instances to escape memoization.