QueryFactoryWithNoInput

class QueryFactoryWithNoInput<TData, TError : Throwable>(cache: OnHandCache, cacheKey: CacheableInput.QueryInput, dispatcher: CoroutineDispatcher = Dispatchers.Default, ttl: Duration? = null, query: suspend () -> TData)

Factory for creating CacheableQueryWithNoInput instances.

The query lambda runs on Dispatchers.Default. If your query performs IO (network, disk), use withContext(Dispatchers.IO) inside your lambda. Do not use launch or async inside the lambda without awaiting — the fetch must complete sequentially so that state transitions (LOADING → SUCCESS/ERROR) are correct.

Constructors

Link copied to clipboard
constructor(cache: OnHandCache, cacheKey: CacheableInput.QueryInput, dispatcher: CoroutineDispatcher = Dispatchers.Default, ttl: Duration? = null, query: suspend () -> TData)

Functions

Link copied to clipboard
fun create(coroutineScope: CoroutineScope, initialFetchState: FetchState = FetchState.IDLE): CacheableQueryWithNoInput<TData, TError>
Link copied to clipboard
operator fun invoke(coroutineScope: CoroutineScope, initialFetchState: FetchState = FetchState.IDLE): CacheableQueryWithNoInput<TData, TError>
Link copied to clipboard
suspend fun refetch()