Package org.dataloader
Class DataLoaderOptions
java.lang.Object
org.dataloader.DataLoaderOptions
Configuration options for
DataLoader
instances. This is an immutable class so each time
you change a value it returns a new object.-
Nested Class Summary
Nested Classes -
Constructor Summary
ConstructorsConstructorDescriptionCreates a new data loader options with default settings. -
Method Summary
Modifier and TypeMethodDescriptionboolean
Option that determines whether to use batching (the default), or not.Gets an (optional) function to invoke for creation of the cache key, if caching is enabled.cacheMap()
Gets the (optional) cache map implementation that is used for caching, if caching is enabled.boolean
Option that determines whether to use caching of futures (the default), or not.boolean
Option that determines whether to cache exceptional values (the default), or not.boolean
int
Gets the maximum number of keys that will be presented to theBatchLoader
function before they are split into multiple classstatic DataLoaderOptions
static DataLoaderOptions.Builder
static DataLoaderOptions.Builder
newOptions
(DataLoaderOptions otherOptions) Copies the options into a new buildertransform
(Consumer<DataLoaderOptions.Builder> builderConsumer) Will transform the current options in to a builder ands allow you to build a new set of optionsOptional<ValueCache<?,
?>> Gets the (optional) cache store implementation that is used for value caching, if caching is enabled.
-
Constructor Details
-
DataLoaderOptions
public DataLoaderOptions()Creates a new data loader options with default settings.
-
-
Method Details
-
newDefaultOptions
- Returns:
- a new default data loader options that you can then customize
-
newOptions
- Returns:
- a new default data loader options builder that you can then customize
-
newOptions
Copies the options into a new builder- Returns:
- a new default data loader options builder that you can then customize
-
transform
Will transform the current options in to a builder ands allow you to build a new set of options- Parameters:
builderConsumer
- the consumer of a builder that has this objects starting values- Returns:
- a new
DataLoaderOptions
object
-
equals
-
batchingEnabled
public boolean batchingEnabled()Option that determines whether to use batching (the default), or not.- Returns:
true
when batching is enabled,false
otherwise
-
cachingEnabled
public boolean cachingEnabled()Option that determines whether to use caching of futures (the default), or not.- Returns:
true
when caching is enabled,false
otherwise
-
cachingExceptionsEnabled
public boolean cachingExceptionsEnabled()Option that determines whether to cache exceptional values (the default), or not.For short-lived caches (that is request caches) it makes sense to cache exceptions since it's likely the key is still poisoned. However, if you have long-lived caches, then it may make sense to set this to false since the downstream system may have recovered from its failure mode.
- Returns:
true
when exceptional values are cached is enabled,false
otherwise
-
cacheKeyFunction
Gets an (optional) function to invoke for creation of the cache key, if caching is enabled.If missing the cache key defaults to the
key
type parameter of the data loader of typeK
.- Returns:
- an optional with the function, or empty optional
-
cacheMap
Gets the (optional) cache map implementation that is used for caching, if caching is enabled.If missing a standard
LinkedHashMap
will be used as the cache implementation.- Returns:
- an optional with the cache map instance, or empty
-
maxBatchSize
public int maxBatchSize()Gets the maximum number of keys that will be presented to theBatchLoader
function before they are split into multiple class- Returns:
- the maximum batch size or -1 if there is no limit
-
getStatisticsCollector
- Returns:
- the statistics collector to use with these options
-
getBatchLoaderContextProvider
- Returns:
- the batch environment provider that will be used to give context to batch load functions
-
valueCache
Gets the (optional) cache store implementation that is used for value caching, if caching is enabled.If missing, a no-op implementation will be used.
- Returns:
- an optional with the cache store instance, or empty
-
getValueCacheOptions
- Returns:
- the
ValueCacheOptions
that control how theValueCache
will be used
-
getBatchLoaderScheduler
- Returns:
- the
BatchLoaderScheduler
to use, which can be null
-
getInstrumentation
- Returns:
- the
DataLoaderInstrumentation
to use
-