Skip to content

Commit e1a4d02

Browse files
clarify documentation on cache()
1 parent 6a4a3d0 commit e1a4d02

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

language-adaptors/rxjava-scala/src/main/scala/rx/lang/scala/Observable.scala

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1015,7 +1015,11 @@ trait Observable[+T]
10151015
* This is useful when you want an Observable to cache responses and you can't control the
10161016
* subscribe/unsubscribe behavior of all the [[rx.lang.scala.Observer]]s.
10171017
*
1018-
* NOTE: You sacrifice the ability to unsubscribe from the origin when you use the
1018+
* When you call `cache`, it does not yet subscribe to the
1019+
* source Observable. This only happens when `subscribe` is called
1020+
* the first time on the Observable returned by `cache()`.
1021+
*
1022+
* Note: You sacrifice the ability to unsubscribe from the origin when you use the
10191023
* `cache()` operator so be careful not to use this operator on Observables that
10201024
* emit an infinite or very large number of items that will use up memory.
10211025
*

rxjava-core/src/main/java/rx/Observable.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4218,6 +4218,10 @@ public Observable<T> retry() {
42184218
* can't control the subscribe/unsubscribe behavior of all the
42194219
* {@link Observer}s.
42204220
* <p>
4221+
* When you call {@code cache()}, it does not yet subscribe to the
4222+
* source Observable. This only happens when {@code subscribe} is called
4223+
* the first time on the Observable returned by {@code cache()}.
4224+
* <p>
42214225
* Note: You sacrifice the ability to unsubscribe from the origin when you
42224226
* use the <code>cache()</code> operator so be careful not to use this
42234227
* operator on Observables that emit an infinite or very large number of

0 commit comments

Comments
 (0)