Target filter
Search Kotlin docs
  • Platforms
  • Tealium Prism Kotlin
core/com.tealium.prism.core.api.network/ResourceRefresher

ResourceRefresher

interface ResourceRefresher<T : DataItemConvertible>

A utility class to repeatedly fetch some resource

The ResourceRefresher.Parameters can be used to configure where to fetch the resource from and how often, as well as some cooldown behaviour in the event of any failures.

Types

Parameters
Link copied to clipboard
data class Parameters(val id: String, val url: URL, val refreshInterval: TimeFrame, val errorCooldownBaseInterval: TimeFrame? = null)

Parameters explicitly relating to the behavior of the ResourceRefresher.

Properties

cache
Link copied to clipboard
abstract val cache: ResourceCache<T>

The ResourceCache for storing the results and possible etags in.

errors
Link copied to clipboard
abstract val errors: Observable<TealiumIOException>

An observable stream of exceptions that occur when fetching or reading/writing from storage.

resource
Link copied to clipboard
abstract val resource: Observable<T>

An observable stream of valid resources.

shouldRefresh
Link copied to clipboard
abstract val shouldRefresh: Boolean

Returns whether or not this resource should be refreshed according to all relevant timeouts and error cooldowns.

Functions

requestRefresh
Link copied to clipboard
abstract fun requestRefresh()

Requests that a new refresh of the resource take place. No validation is done on the object that is retrieved.

abstract fun requestRefresh(isValid: (T) -> Boolean)

Requests that a new refresh of the resource take place. The resulting object is passed to the isValid predicate to determine whether or not this should be considered a successful retrieval.

setRefreshInterval
Link copied to clipboard
abstract fun setRefreshInterval(interval: TimeFrame)

Updates the refresh interval for this resource.

Generated by Dokka
(c) Tealium 2026