Using RxJS shareReplay as a Simple HTTP Cache in Angular Services
Learn how to apply shareReplay to avoid duplicate HTTP requests, set trust boundaries, check operation, and recognize when the design must evolve.
ReadMeFeed / Community knowledge
Real questions. Useful conversations. Find the people who know your stack.
Learn how to apply shareReplay to avoid duplicate HTTP requests, set trust boundaries, check operation, and recognize when the design must evolve.
When several components need the same HTTP data, each subscription can fire a new request. RxJS’s shareReplay can multicast a single call and cache the result. This guide explains how to use shareReplay, shows a concrete example, discusses trade‑offs, and gives actionable steps for real‑world use.
I'm reviewing a Gatling simulation suite that was written against 3.9 and recently upgraded to 3.10. The tests hit state-dependent REST endpoints where each virtual user presents a session-specific token, and the payloads include timestamps that must be fresh on every iteration. My understanding is that before 3.10, the HTTP protocol cache was enabled by def