kgraphql / com.apurebase.kgraphql.test / TimedAutoDispatcherImpl

TimedAutoDispatcherImpl

class TimedAutoDispatcherImpl<K, R> : SimpleDataLoaderImpl<K, R>, CoroutineScope

Constructors

<init>

TimedAutoDispatcherImpl(options: TimedAutoDispatcherDataLoaderOptions<K, R>, batchLoader: BatchLoader<K, R>, parent: Job? = null)

Properties

coroutineContext

val coroutineContext: CompletableJob

Functions

cancel

suspend fun cancel(): Unit

clear

Removes the value of the given Key from the cache

suspend fun clear(key: K): Unit

clearAll

Removes all values from the cache

suspend fun clearAll(): 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.

suspend fun loadAsync(key: K): Deferred<R>

loadManyAsync

The same as loadAsync but for multiple Keys at once.

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.

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.

suspend fun prime(key: K, value: Throwable): Unit

Extension Functions

prime

suspend fun <K, R> SimpleDataLoaderImpl<K, R>.prime(cacheEntry: Pair<K, R>): Unit
suspend fun <K, R> SimpleDataLoaderImpl<K, R>.prime(cacheEntry: Pair<K, Throwable>): Unit