I am following some tutorials from angular-university and in a video they suggest to use cache() operator to avoid multiple requests. So I tried with the following:
this.posts$ = this.postsService.savePost(post)
.switchMap(() => this.postsService.getPosts())
.publishReplay(1)
.refCount();
and it works but I prefer cache() instead of publishReplay
The naive way to achieve this is:
this.postsService.savePost(post)
.subscribe(() => this.postsService.getPosts())
but it is not kind of reactive.
So I prefer to use cache but I could not find this on the add operators.
Currently I am using rxjs: 5.4.3.
So, is cache supported by the version I am currently using?