blob: 1ef39a2dcef05d5fe00a5e8f4707a5e21a90f6fa [file] [log] [blame]
<html devsite="true">
<head>
<title>PagingRxKt</title>
{% setvar book_path %}/reference/androidx/_book.yaml{% endsetvar %}
{% include "_shared/_reference-head-tags.html" %}
</head>
<body>
<h1>PagingRxKt</h1>
{% setvar page_path %}androidx/paging/rxjava2/PagingRxKt.html{% endsetvar %}
{% setvar can_switch %}1{% endsetvar %}
{% include "reference/_java_switcher2.md" %}
<p>
<pre>public final class PagingRxKt</pre>
</p>
<hr>
<h2>Summary</h2>
<div class="devsite-table-wrapper">
<table class="responsive">
<thead>
<tr>
<th colspan="2"><h3>Public methods</h3></th>
</tr>
</thead>
<tbody>
<tr>
<td><code>static&nbsp;final <a href="/reference/[JVM root]/&lt;ERROR CLASS&gt;.html">&lt;ERROR CLASS&gt;</a>&lt;<a href="/reference/androidx/paging/PagingData.html">PagingData</a>&lt;T&gt;&gt;</code></td>
<td width="100%">
<div><code><a href="/reference/androidx/paging/rxjava2/PagingRxKt.html#cachedIn(,kotlinx.coroutines.CoroutineScope)">cachedIn</a>(<a href="/reference/[JVM root]/&lt;ERROR CLASS&gt;.html">&lt;ERROR CLASS&gt;</a>&lt;<a href="/reference/androidx/paging/PagingData.html">PagingData</a>&lt;T&gt;&gt;&nbsp;receiver,&nbsp;<a href="/reference/kotlinx/coroutines/CoroutineScope.html">CoroutineScope</a>&nbsp;scope)</code></div>
<p>Operator which caches an Observable of <code><a href="/reference/androidx/paging/PagingData.html">PagingData</a></code> within a <code><a href="/reference/kotlinx/coroutines/CoroutineScope.html">CoroutineScope</a></code>.</p>
</td>
</tr>
<tr>
<td><code>static&nbsp;final <a href="/reference/[JVM root]/&lt;ERROR CLASS&gt;.html">&lt;ERROR CLASS&gt;</a>&lt;<a href="/reference/androidx/paging/PagingData.html">PagingData</a>&lt;T&gt;&gt;</code></td>
<td width="100%">
<div><code><a href="/reference/androidx/paging/rxjava2/PagingRxKt.html#cachedIn(,kotlinx.coroutines.CoroutineScope)">cachedIn</a>(<a href="/reference/[JVM root]/&lt;ERROR CLASS&gt;.html">&lt;ERROR CLASS&gt;</a>&lt;<a href="/reference/androidx/paging/PagingData.html">PagingData</a>&lt;T&gt;&gt;&nbsp;receiver,&nbsp;<a href="/reference/kotlinx/coroutines/CoroutineScope.html">CoroutineScope</a>&nbsp;scope)</code></div>
<p>Operator which caches a Flowable of <code><a href="/reference/androidx/paging/PagingData.html">PagingData</a></code> within a <code><a href="/reference/kotlinx/coroutines/CoroutineScope.html">CoroutineScope</a></code>.</p>
</td>
</tr>
</tbody>
</table>
</div>
<h2>Public methods</h2>
<div><a name="cachedIn(, kotlinx.coroutines.CoroutineScope)"></a><a name="cachedIn--kotlinx.coroutines.CoroutineScope-"></a>
<h3 class="api-name" id="cachedIn(,kotlinx.coroutines.CoroutineScope)">cachedIn</h3>
<pre class="api-signature no-pretty-print">@<a href="/reference/kotlin/OptIn.html">OptIn</a>(markerClass&nbsp;=&nbsp;[ExperimentalCoroutinesApi])<br>public&nbsp;static&nbsp;final&nbsp;<a href="/reference/[JVM root]/&lt;ERROR CLASS&gt;.html">&lt;ERROR CLASS&gt;</a>&lt;<a href="/reference/androidx/paging/PagingData.html">PagingData</a>&lt;T&gt;&gt;&nbsp;<a href="/reference/androidx/paging/rxjava2/PagingRxKt.html#cachedIn(,kotlinx.coroutines.CoroutineScope)">cachedIn</a>(<a href="/reference/[JVM root]/&lt;ERROR CLASS&gt;.html">&lt;ERROR CLASS&gt;</a>&lt;<a href="/reference/androidx/paging/PagingData.html">PagingData</a>&lt;T&gt;&gt;&nbsp;receiver,&nbsp;<a href="/reference/kotlinx/coroutines/CoroutineScope.html">CoroutineScope</a>&nbsp;scope)</pre>
<p>Operator which caches an <a href="[Observable]">Observable</a> of <code><a href="/reference/androidx/paging/PagingData.html">PagingData</a></code> within a <code><a href="/reference/kotlinx/coroutines/CoroutineScope.html">CoroutineScope</a></code>.</p>
<p><code><a href="/reference/androidx/paging/package-summary.html#cachedIn(kotlinx.coroutines.flow.Flow,kotlinx.coroutines.CoroutineScope)">cachedIn</a></code> multicasts pages loaded and transformed by a <code><a href="/reference/androidx/paging/PagingData.html">PagingData</a></code>, allowing multiple observers on the same instance of <code><a href="/reference/androidx/paging/PagingData.html">PagingData</a></code> to receive the same events, avoiding redundant work, but comes at the cost of buffering those events in memory.</p>
<p>Calling <code><a href="/reference/androidx/paging/package-summary.html#cachedIn(kotlinx.coroutines.flow.Flow,kotlinx.coroutines.CoroutineScope)">cachedIn</a></code> is required to allow calling <a href="[androidx.paging.AsyncPagingDataAdapter]">androidx.paging.AsyncPagingDataAdapter</a> on the same instance of <code><a href="/reference/androidx/paging/PagingData.html">PagingData</a></code> emitted by <code><a href="/reference/androidx/paging/Pager.html">Pager</a></code> or any of its transformed derivatives, as reloading data from scratch on the same generation of <code><a href="/reference/androidx/paging/PagingData.html">PagingData</a></code> is an unsupported operation.</p>
<div class="devsite-table-wrapper">
<table class="responsive">
<thead>
<tr>
<th colspan="2">Parameters</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>scope</code></td>
<td width="100%">
<p>The <code><a href="/reference/kotlinx/coroutines/CoroutineScope.html">CoroutineScope</a></code> where the page cache will be kept alive. Typically this would be a managed scope such as <code>ViewModel.viewModelScope</code>, which automatically cancels after the <code><a href="/reference/androidx/paging/PagingData.html">PagingData</a></code> stream is no longer needed. Otherwise, the provided <code><a href="/reference/kotlinx/coroutines/CoroutineScope.html">CoroutineScope</a></code> must be manually cancelled to avoid memory leaks.</p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div><a name="cachedIn(, kotlinx.coroutines.CoroutineScope)"></a><a name="cachedIn--kotlinx.coroutines.CoroutineScope-"></a>
<h3 class="api-name" id="cachedIn(,kotlinx.coroutines.CoroutineScope)">cachedIn</h3>
<pre class="api-signature no-pretty-print">@<a href="/reference/kotlin/OptIn.html">OptIn</a>(markerClass&nbsp;=&nbsp;[ExperimentalCoroutinesApi])<br>public&nbsp;static&nbsp;final&nbsp;<a href="/reference/[JVM root]/&lt;ERROR CLASS&gt;.html">&lt;ERROR CLASS&gt;</a>&lt;<a href="/reference/androidx/paging/PagingData.html">PagingData</a>&lt;T&gt;&gt;&nbsp;<a href="/reference/androidx/paging/rxjava2/PagingRxKt.html#cachedIn(,kotlinx.coroutines.CoroutineScope)">cachedIn</a>(<a href="/reference/[JVM root]/&lt;ERROR CLASS&gt;.html">&lt;ERROR CLASS&gt;</a>&lt;<a href="/reference/androidx/paging/PagingData.html">PagingData</a>&lt;T&gt;&gt;&nbsp;receiver,&nbsp;<a href="/reference/kotlinx/coroutines/CoroutineScope.html">CoroutineScope</a>&nbsp;scope)</pre>
<p>Operator which caches a <a href="[Flowable]">Flowable</a> of <code><a href="/reference/androidx/paging/PagingData.html">PagingData</a></code> within a <code><a href="/reference/kotlinx/coroutines/CoroutineScope.html">CoroutineScope</a></code>.</p>
<p><code><a href="/reference/androidx/paging/package-summary.html#cachedIn(kotlinx.coroutines.flow.Flow,kotlinx.coroutines.CoroutineScope)">cachedIn</a></code> multicasts pages loaded and transformed by a <code><a href="/reference/androidx/paging/PagingData.html">PagingData</a></code>, allowing multiple observers on the same instance of <code><a href="/reference/androidx/paging/PagingData.html">PagingData</a></code> to receive the same events, avoiding redundant work, but comes at the cost of buffering those events in memory.</p>
<p>Calling <code><a href="/reference/androidx/paging/package-summary.html#cachedIn(kotlinx.coroutines.flow.Flow,kotlinx.coroutines.CoroutineScope)">cachedIn</a></code> is required to allow calling <a href="[androidx.paging.AsyncPagingDataAdapter]">androidx.paging.AsyncPagingDataAdapter</a> on the same instance of <code><a href="/reference/androidx/paging/PagingData.html">PagingData</a></code> emitted by <code><a href="/reference/androidx/paging/Pager.html">Pager</a></code> or any of its transformed derivatives, as reloading data from scratch on the same generation of <code><a href="/reference/androidx/paging/PagingData.html">PagingData</a></code> is an unsupported operation.</p>
<div class="devsite-table-wrapper">
<table class="responsive">
<thead>
<tr>
<th colspan="2">Parameters</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>scope</code></td>
<td width="100%">
<p>The <code><a href="/reference/kotlinx/coroutines/CoroutineScope.html">CoroutineScope</a></code> where the page cache will be kept alive. Typically this would be a managed scope such as <code>ViewModel.viewModelScope</code>, which automatically cancels after the <code><a href="/reference/androidx/paging/PagingData.html">PagingData</a></code> stream is no longer needed. Otherwise, the provided <code><a href="/reference/kotlinx/coroutines/CoroutineScope.html">CoroutineScope</a></code> must be manually cancelled to avoid memory leaks.</p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</body>
</html>