1

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?

1

1 Answer 1

3

Cache is gone as of version 5.0.0 according to the changlog

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.