resourceRefresher
Creates a ResourceRefresher that will regularly fetch updated values from a remote source as specified in the given parameters.
Use the parameters to dictate how often the ResourceRefresher will refresh, and where to fetch updates from.
The refresher fetches through the shared networkHelper, which makes a single attempt per request; use the overload taking a NetworkHelper to retry failed fetches.
Parameters
The DataStore to store the results in
The DataItemConverter implementation for converting values to/from
The configuration to control the ResourceRefresher behavior
Creates a ResourceRefresher that will regularly fetch updated values from a remote source as specified in the given parameters, through the given networkHelper.
Use the parameters to dictate how often the ResourceRefresher will refresh, and where to fetch updates from.
To retry failed fetches, pass a helper from a derived client, e.g. from a module:
context.network.networkClient
.newClient(
listOf(
RequestInterceptors.retryWithBackoff(),
RequestInterceptors.retryWhenConnected(context.network)
)
)
.makeNetworkHelper()Parameters
The DataStore to store the results in
The DataItemConverter implementation for converting values to/from
The configuration to control the ResourceRefresher behavior
The NetworkHelper to fetch the resource with