An RxJava transformer that combines replay(1), publish(), and refCount() operators for efficient value caching.
ReplayingShare is an RxJava transformer that combines replay(1), publish(), and refCount() operators into a single optimized operator. It solves the problem of efficiently sharing expensive observable streams by caching the last emitted value only when subscribers are present and automatically disconnecting from upstream when no one is listening.
RxJava developers working with expensive or long-lived observable streams who need to share them across multiple subscribers while managing resource consumption.
Developers choose ReplayingShare because it provides the ideal combination of value replay and resource management in a single operator, eliminating the need to manually compose multiple operators and avoiding the pitfalls of traditional combinations.
An RxJava transformer which combines replay(1), publish(), and refCount() operators.
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Caches the last emitted value only when downstream subscribers are connected, preventing unnecessary resource usage as highlighted in the README's comparison table against alternatives.
Disconnects from upstream sources when no subscribers are listening, unlike replay(1).autoConnect(1), ensuring efficient resource handling for long-lived streams.
Replays the latest value to new subscribers regardless of whether other subscribers are active, addressing gaps in publish().refCount() behavior as shown in the feature matrix.
Specifically designed for infinite or extremely long-lived observable streams, with usage notes emphasizing this focus to avoid misuse on terminating streams.
Only caches the last emitted value (replay(1)), so it cannot replay a history of values, which may be insufficient for applications needing multi-value buffering.
Clears the cached value on any terminal event (error or completion), as noted in the README, which can disrupt caching in streams that might terminate unexpectedly.
Tied specifically to RxJava with separate artifacts for different versions, creating vendor lock-in and limiting portability to other reactive frameworks.