Class FlowableCache<T>

java.lang.Object
io.reactivex.rxjava3.core.Flowable<T>
io.reactivex.rxjava3.internal.operators.flowable.FlowableCache<T>
Type Parameters:
T - the source element type
All Implemented Interfaces:
FlowableSubscriber<T>, HasUpstreamPublisher<T>, org.reactivestreams.Publisher<T>, org.reactivestreams.Subscriber<T>

public final class FlowableCache<T> extends Flowable<T> implements FlowableSubscriber<T>
An observable which auto-connects to another observable, caches the elements from that observable but allows terminating the connection and completing the cache.
  • Field Details

    • source

      protected final Flowable<T> source
      The upstream source Publisher.
  • Constructor Details

    • FlowableCache

      public FlowableCache(Flowable<T> source, int capacityHint)
      Constructs an empty, non-connected cache.
      Parameters:
      source - the source to subscribe to for the first incoming subscriber
      capacityHint - the number of items expected (reduce allocation frequency)
  • Method Details

    • subscribeActual

      protected void subscribeActual(org.reactivestreams.Subscriber<? super T> t)
      Description copied from class: Flowable
      Operator implementations (both source and intermediate) should implement this method that performs the necessary business logic and handles the incoming Subscribers.

      There is no need to call any of the plugin hooks on the current Flowable instance or the Subscriber; all hooks and basic safeguards have been applied by Flowable.subscribe(Subscriber) before this method gets called.

      Specified by:
      subscribeActual in class Flowable<T>
      Parameters:
      t - the incoming Subscriber, never null
    • onSubscribe

      public void onSubscribe(org.reactivestreams.Subscription s)
      Description copied from interface: FlowableSubscriber
      Implementors of this method should make sure everything that needs to be visible in Subscriber.onNext(Object) is established before calling Subscription.request(long). In practice this means no initialization should happen after the request() call and additional behavior is thread safe in respect to onNext.
      Specified by:
      onSubscribe in interface FlowableSubscriber<T>
      Specified by:
      onSubscribe in interface org.reactivestreams.Subscriber<T>
    • onNext

      public void onNext(T t)
      Specified by:
      onNext in interface org.reactivestreams.Subscriber<T>
    • onError

      public void onError(Throwable t)
      Specified by:
      onError in interface org.reactivestreams.Subscriber<T>
    • onComplete

      public void onComplete()
      Specified by:
      onComplete in interface org.reactivestreams.Subscriber<T>
    • source

      public final org.reactivestreams.Publisher<T> source()
      Description copied from interface: HasUpstreamPublisher
      Returns the source Publisher.

      This method is intended to discover the assembly graph of sequences.

      Specified by:
      source in interface HasUpstreamPublisher<T>
      Returns:
      the source Publisher