Class ObservableCache<T>

java.lang.Object
io.reactivex.rxjava3.core.Observable<T>
io.reactivex.rxjava3.internal.operators.observable.ObservableCache<T>
Type Parameters:
T - the source element type
All Implemented Interfaces:
ObservableSource<T>, Observer<T>, HasUpstreamObservableSource<T>

public final class ObservableCache<T> extends Observable<T> implements Observer<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 ObservableSource<T> source
      The source consumable Observable.
  • Constructor Details

    • ObservableCache

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