{% setvar book_path %}/reference/kotlin/androidx/_book.yaml{% endsetvar %} {% include "_shared/_reference-head-tags.html" %}
class PagingLiveData
Public functions |
|
---|---|
<ERROR CLASS> |
<T : Any> <ERROR CLASS><PagingData<T>>.cachedIn(lifecycle: <ERROR CLASS>) Operator which caches a LiveData of |
<ERROR CLASS> |
<T : Any> <ERROR CLASS><PagingData<T>>.cachedIn(viewModel: <ERROR CLASS>) Operator which caches a LiveData of |
<ERROR CLASS> |
<T : Any> <ERROR CLASS><PagingData<T>>.cachedIn(scope: CoroutineScope) Operator which caches a LiveData of |
fun <T : Any> <ERROR CLASS><PagingData<T>>.cachedIn(lifecycle: <ERROR CLASS>): <ERROR CLASS>
Operator which caches a LiveData of PagingData
within the scope of a Lifecycle.
cachedIn
multicasts pages loaded and transformed by a PagingData
, allowing multiple observers on the same instance of PagingData
to receive the same events, avoiding redundant work, but comes at the cost of buffering those pages in memory.
Calling cachedIn
is required to allow calling androidx.paging.AsyncPagingDataAdapter on the same instance of PagingData
emitted by Pager
or any of its transformed derivatives, as reloading data from scratch on the same generation of PagingData
is an unsupported operation.
Parameters | |
---|---|
lifecycle: <ERROR CLASS> |
The Lifecycle where the page cache will be kept alive. |
fun <T : Any> <ERROR CLASS><PagingData<T>>.cachedIn(viewModel: <ERROR CLASS>): <ERROR CLASS>
Operator which caches a LiveData of PagingData
within the scope of a ViewModel.
cachedIn
multicasts pages loaded and transformed by a PagingData
, allowing multiple observers on the same instance of PagingData
to receive the same events, avoiding redundant work, but comes at the cost of buffering those pages in memory.
Calling cachedIn
is required to allow calling androidx.paging.AsyncPagingDataAdapter on the same instance of PagingData
emitted by Pager
or any of its transformed derivatives, as reloading data from scratch on the same generation of PagingData
is an unsupported operation.
Parameters | |
---|---|
viewModel: <ERROR CLASS> |
The ViewModel whose viewModelScope will dictate how long the page cache will be kept alive. |
fun <T : Any> <ERROR CLASS><PagingData<T>>.cachedIn(scope: CoroutineScope): <ERROR CLASS>
Operator which caches a LiveData of PagingData
within a CoroutineScope
.
cachedIn
multicasts pages loaded and transformed by a PagingData
, allowing multiple observers on the same instance of PagingData
to receive the same events, avoiding redundant work, but comes at the cost of buffering those pages in memory.
Calling cachedIn
is required to allow calling androidx.paging.AsyncPagingDataAdapter on the same instance of PagingData
emitted by Pager
or any of its transformed derivatives, as reloading data from scratch on the same generation of PagingData
is an unsupported operation.
Parameters | |
---|---|
scope: CoroutineScope |
The |