Skip to content

Commit c53a473

Browse files
Merge pull request #574 from samuelgruetter/cache-documentation
clarify documentation on cache()
2 parents ae866be + e1a4d02 commit c53a473

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
@@ -1013,7 +1013,11 @@ trait Observable[+T]
10131013
* This is useful when you want an Observable to cache responses and you can't control the
10141014
* subscribe/unsubscribe behavior of all the [[rx.lang.scala.Observer]]s.
10151015
*
1016-
* NOTE: You sacrifice the ability to unsubscribe from the origin when you use the
1016+
* When you call `cache`, it does not yet subscribe to the
1017+
* source Observable. This only happens when `subscribe` is called
1018+
* the first time on the Observable returned by `cache()`.
1019+
*
1020+
* Note: You sacrifice the ability to unsubscribe from the origin when you use the
10171021
* `cache()` operator so be careful not to use this operator on Observables that
10181022
* emit an infinite or very large number of items that will use up memory.
10191023
*

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

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

0 commit comments

Comments
 (0)