suparnatural-cache / com.suparnatural.core.cache / CacheStoreNonBlockingWorker

CacheStoreNonBlockingWorker

class CacheStoreNonBlockingWorker : CacheStoreWorker

A background worker for the cache store which does not block the calling thread. The calling thread cannot wait for the result. Therefore, this worker is supposed to be used in a fire and forget scenario. Otherwise, use CacheStoreBlockingWorker.

Constructors

<init>

CacheStoreNonBlockingWorker()

A background worker for the cache store which does not block the calling thread. The calling thread cannot wait for the result. Therefore, this worker is supposed to be used in a fire and forget scenario. Otherwise, use CacheStoreBlockingWorker.

Properties

worker

val worker: <ERROR CLASS>

An instance of com.suparnatural.core.concurrency.Worker.

Functions

persistObject

fun <T : Cacheable> persistObject(input: <ERROR CLASS><T, <ERROR CLASS>, List<CacheStorePreprocessor<Cacheable, Cacheable, Cacheable>>?>, task: (<ERROR CLASS><T, <ERROR CLASS>, List<CacheStorePreprocessor<Cacheable, Cacheable, Cacheable>>?>) -> Unit): Unit

Adds an object by scheduling a task on the worker.

terminate

fun terminate(): <ERROR CLASS><Unit>

Terminates the worker. This method is always invoked on the calling thread.

unlinkObject

fun unlinkObject(input: <ERROR CLASS>, task: (<ERROR CLASS>) -> Unit): Unit

Removes an object by scheduling a task on the worker.

Inherited Functions

persistObject

abstract fun <T : Cacheable> persistObject(input: <ERROR CLASS><T, <ERROR CLASS>, List<CacheStorePreprocessor<Cacheable, Cacheable, Cacheable>>?>, task: (<ERROR CLASS><T, <ERROR CLASS>, List<CacheStorePreprocessor<Cacheable, Cacheable, Cacheable>>?>) -> Unit): Unit

Invokes a strictly non-capturing lambda task with the input as an argument to persist T. The task must not access any state other than its arguments including any immutable of frozen objects to guarantee thread safety.

unlinkObject

abstract fun unlinkObject(input: <ERROR CLASS>, task: (<ERROR CLASS>) -> Unit): Unit

Invokes a strictly non-capturing lambda task with input to delete an object located at input. The task must not access any state other than its arguments including any immutable of frozen objects to guarantee thread safety.