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

dataStore

The DataStore to store the results in

converter

The DataItemConverter implementation for converting values to/from

parameters

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

dataStore

The DataStore to store the results in

converter

The DataItemConverter implementation for converting values to/from

parameters

The configuration to control the ResourceRefresher behavior

networkHelper

The NetworkHelper to fetch the resource with