Check out the CodeOmelet blog post for this project.
Link: https://codeomelet.com/posts/cache-angular-http-request-using-ngneat-cashew
NgCashew app to explore the air light @ngneat/cashew
package to cache Angular HTTP requests powered by Cirrus UI.
npm start
npm i @ngneat/cashew
@NgModule({
imports: [
HttpClientModule,
HttpCacheInterceptorModule.forRoot(),
...
],
})
Configure the options object:
private options = {
context: withCache()
};
Pass it to get
method:
getUsers() {
const url = `${this.url}${this.userUrl}`;
return this.http.get<any>(url, this.options);
}