SwrCachePolicy

fun SwrCachePolicy(coroutineScope: CoroutineScope, mainDispatcher: CoroutineDispatcher = Dispatchers.Main, mutationOptions: MutationOptions = MutationOptions, mutationReceiver: MutationReceiver = MutationReceiver, queryOptions: QueryOptions = QueryOptions, queryReceiver: QueryReceiver = QueryReceiver, queryCache: QueryCache = QueryCache(), batchSchedulerFactory: BatchSchedulerFactory = BatchSchedulerFactory.default(mainDispatcher), errorRelay: ErrorRelay? = null, memoryPressure: MemoryPressure = MemoryPressure, networkConnectivity: NetworkConnectivity = NetworkConnectivity, networkResumeAfterDelay: Duration = 2.seconds, networkResumeQueriesFilter: ResumeQueriesFilter = ResumeQueriesFilter( predicate = { it.isFailure } ), windowVisibility: WindowVisibility = WindowVisibility, windowResumeQueriesFilter: ResumeQueriesFilter = ResumeQueriesFilter( predicate = { it.isStaled() } )): SwrCachePolicy

Create a new SwrCachePolicy instance.

Parameters

coroutineScope

CoroutineScope for coroutines executed on the SwrCache.

mainDispatcher

CoroutineDispatcher for the main thread.

mutationOptions

Default MutationOptions applied to Mutation.

mutationReceiver

Extension receiver for referencing external instances needed when executing mutate.

queryOptions

Default QueryOptions applied to Query.

queryReceiver

Extension receiver for referencing external instances needed when executing fetch.

queryCache

Management of cached data for inactive Query instances.

batchSchedulerFactory

Factory for creating a soil.query.core.BatchScheduler.

errorRelay

Specify the mechanism of ErrorRelay when using SwrClient.errorRelay.

memoryPressure

Receiving events of memory pressure.

networkConnectivity

Receiving events of network connectivity.

networkResumeAfterDelay

The delay time to resume queries after network connectivity is reconnected.

networkResumeQueriesFilter

The specified filter to resume queries after network connectivity is reconnected.

windowVisibility

Receiving events of window visibility.

windowResumeQueriesFilter

The specified filter to resume queries after window visibility is refocused.