interface DataLoader<K, R>
options |
abstract val options: DataLoaderOptions<K, R> |
clear |
Removes the value of the given Key from the cache abstract suspend fun clear(key: K): Unit |
clearAll |
Removes all values from the cache abstract suspend fun clearAll(): Unit |
createStatisticsSnapshot |
Returns a snapshot of the statistics at the point of calling abstract suspend fun createStatisticsSnapshot(): DataLoaderStatistics |
dispatch |
Executes all stored requests via the given batchLoader. After this function finishes all Deferred created before are completed. abstract suspend fun dispatch(): Unit |
loadAsync |
Loads the value for the given Key. The returned Deferred completes with the finish of dispatch in case of DataLoaderOptions.batchLoadEnabled = true. If DataLoaderOptions.batchLoadEnabled = false it calls the BatchLoader immediately and returns the retrieved value. abstract suspend fun loadAsync(key: K): Deferred<R> |
loadManyAsync |
The same as loadAsync but for multiple Keys at once. abstract suspend fun loadManyAsync(vararg keys: K): Deferred<List<R>> |
prime |
Primes the cache with the given values. After priming the BatchLoader will not be called with this key. abstract suspend fun prime(key: K, value: R): Unit
Primes the cache with the given Throwable. After priming the BatchLoader will not be called with this key, if DataLoaderOptions.cacheExceptions = true. abstract suspend fun prime(key: K, value: Throwable): Unit |
SimpleDataLoaderImpl |
open class SimpleDataLoaderImpl<K, R> : DataLoader<K, R> |