Closed wbinarytree closed 7 years ago
That will never disconnect from the upstream.
From the README (emphasis added):
Unlike traditional combinations of these operators,
ReplayingShare
caches the last emitted value from the upstream observable or flowable only when one or more downstream subscribers are connected. This allows expensive upstream sources to be shut down when no one is listening while also replaying the last value seen by any subscriber to new ones.
I understand how it's different from autoConnect, but I'm trying to understand the difference between this operator and replay(1).refCount()
.
Any terminal event will clear the cached value.
^ That's true for both ReplayingShare and replay.refCount.
They'll also both disconnect from the upstream when they hit 0 subscribers. Is the difference that the cached value will be retained in this case with ReplayingShare, while replay(1).refCount()
will treat that case just like a terminal event and discard the cached value?
Precisely!
On Wed, Mar 13, 2019 at 6:09 PM Stav Raviv notifications@github.com wrote:
I understand how it's different from autoConnect, but I'm trying to understand the difference between this operator and replay(1).refCount().
Any terminal event will clear the cached value.
^ That's true for both ReplayingShare and replay.refCount. They'll also both disconnect from the upstream when they hit 0 subscribers. Is the difference that the cached value will be retained in this case with ReplayingShare, while replay(1).refCount() will treat that case just like a terminal event and discard the cached value?
— You are receiving this because you modified the open/close state.
Reply to this email directly, view it on GitHub https://github.com/JakeWharton/RxReplayingShare/issues/20#issuecomment-472625459, or mute the thread https://github.com/notifications/unsubscribe-auth/AAEEEQ3GNDLCYjo6ixHBSGjQ1GnQ9M1Xks5vWXcKgaJpZM4M2z9- .
I listened to the http://fragmentedpodcast.com/episodes/053-jake-wharton-on-rxjava-2/ about this lib. But somehow I feel replay(1).autoConnect() do the same with this lib? Could you please explain a bit about this?