DEV Community

Discussion on: How to cache HTTP requests in Angular

Collapse
 
sanketmaru profile image
Sanket Maru

Thanks Bartosz Pietrucha , TIL about this.
Does this mean everytime a request is made records will be served from the cache except first request.
How can i invalidate this and make a fresh request ?

Collapse
 
bartosz_io profile image
Bartosz Pietrucha Angular

Hi Sanket Maru! Yes, that's the idea of the cache.
Regarding invalidation, you can create another stream without shareReplay and fetch the data or set a timeout (windowTime) on shareReplay (rxjs-dev.firebaseapp.com/api/opera...).