-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(cache): add cache operator #1320
Conversation
Related #839 |
@Blesh tests look alright, except there could be more of them (but that's debatable since we already have tests for publishReplay). |
@staltz that's what I was thinking, I tried to add tests I thought were specific to the behavior, but I can add a few more and repeat those other tests I suppose. |
PS: what happened to the "advanced cache invalidation attributes" ideas for this operator? |
Lack of interest, mostly. |
I've gotten some feedback from a few people that perhaps this operator requires some sisters like:
|
Instead of the above operators what about a config object?
|
Alternatively, how do people feel about reversing the order of arguments? |
maybe name it to |
I said this on twitter, but I think most people want caching by count, usually just 1 or 2, even. Maybe best if that's the first param if this will take multiple params (but I think splitting this into multiple operators would be nicer...) But if you change the options hash to allow more/less/different values, then that's a change in the type of object you can send through, making it messy. |
This is because the size is a time unit in milliseconds. Just a disambiguation
It's a neat API, we should consider it for the future, but right now it's not consistent with the rest. |
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
The
cache
operator is effectivelypublishReplay
andrefCount
.The main reasons it's not named
shareReplay
:share
" no longer means "publishTypeX + refCount" in RxJS 5. It's not publish().refCount() it's a replayable refCounted observable. SoshareReplay
doesn't make sense, as this has little to do withshare
.cache
is more terse and descriptive to the general user. What does it do? It caches values. Does it share a replay? sure. Will new users ever search for that... probably not? Debatable.Bike shedding is bike shedding. I think it's cleaner.
(ATTN: @staltz ... I think there's probably a better way to write the tests than what I did)