@PublicApi public class DataLoaderOptions extends java.lang.Object
DataLoader instances.| Constructor and Description |
|---|
DataLoaderOptions()
Creates a new data loader options with default settings.
|
DataLoaderOptions(DataLoaderOptions other)
Clones the provided data loader options.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
batchingEnabled()
Option that determines whether to use batching (the default), or not.
|
java.util.Optional<CacheKey> |
cacheKeyFunction()
Gets an (optional) function to invoke for creation of the cache key, if caching is enabled.
|
java.util.Optional<CacheMap<?,?>> |
cacheMap()
Gets the (optional) cache map implementation that is used for caching, if caching is enabled.
|
boolean |
cachingEnabled()
Option that determines whether to use caching of futures (the default), or not.
|
boolean |
cachingExceptionsEnabled()
Option that determines whether to cache exceptional values (the default), or not.
|
BatchLoaderContextProvider |
getBatchLoaderContextProvider() |
StatisticsCollector |
getStatisticsCollector() |
ValueCacheOptions |
getValueCacheOptions() |
int |
maxBatchSize()
Gets the maximum number of keys that will be presented to the
BatchLoader function
before they are split into multiple class |
static DataLoaderOptions |
newOptions() |
DataLoaderOptions |
setBatchingEnabled(boolean batchingEnabled)
Sets the option that determines whether batch loading is enabled.
|
DataLoaderOptions |
setBatchLoaderContextProvider(BatchLoaderContextProvider contextProvider)
Sets the batch loader environment provider that will be used to give context to batch load functions
|
DataLoaderOptions |
setCacheKeyFunction(CacheKey<?> cacheKeyFunction)
Sets the function to use for creating the cache key, if caching is enabled.
|
DataLoaderOptions |
setCacheMap(CacheMap<?,?> cacheMap)
Sets the cache map implementation to use for caching, if caching is enabled.
|
DataLoaderOptions |
setCachingEnabled(boolean cachingEnabled)
Sets the option that determines whether caching is enabled.
|
DataLoaderOptions |
setCachingExceptionsEnabled(boolean cachingExceptionsEnabled)
Sets the option that determines whether exceptional values are cachedis enabled.
|
DataLoaderOptions |
setMaxBatchSize(int maxBatchSize)
Sets the maximum number of keys that will be presented to the
BatchLoader function
before they are split into multiple class |
DataLoaderOptions |
setStatisticsCollector(java.util.function.Supplier<StatisticsCollector> statisticsCollector)
Sets the statistics collector supplier that will be used with these data loader options.
|
DataLoaderOptions |
setValueCache(ValueCache<?,?> valueCache)
Sets the value cache implementation to use for caching values, if caching is enabled.
|
DataLoaderOptions |
setValueCacheOptions(ValueCacheOptions valueCacheOptions)
Sets the
ValueCacheOptions that control how the ValueCache will be used |
java.util.Optional<ValueCache<?,?>> |
valueCache()
Gets the (optional) cache store implementation that is used for value caching, if caching is enabled.
|
public DataLoaderOptions()
public DataLoaderOptions(DataLoaderOptions other)
other - the other options instancepublic static DataLoaderOptions newOptions()
public boolean batchingEnabled()
true when batching is enabled, false otherwisepublic DataLoaderOptions setBatchingEnabled(boolean batchingEnabled)
batchingEnabled - true to enable batch loading, false otherwisepublic boolean cachingEnabled()
true when caching is enabled, false otherwisepublic DataLoaderOptions setCachingEnabled(boolean cachingEnabled)
cachingEnabled - true to enable caching, false otherwisepublic boolean cachingExceptionsEnabled()
true when exceptional values are cached is enabled, false otherwisepublic DataLoaderOptions setCachingExceptionsEnabled(boolean cachingExceptionsEnabled)
cachingExceptionsEnabled - true to enable caching exceptional values, false otherwisepublic java.util.Optional<CacheKey> cacheKeyFunction()
If missing the cache key defaults to the key type parameter of the data loader of type K.
public DataLoaderOptions setCacheKeyFunction(CacheKey<?> cacheKeyFunction)
cacheKeyFunction - the cache key function to usepublic java.util.Optional<CacheMap<?,?>> cacheMap()
If missing a standard LinkedHashMap will be used as the cache implementation.
public DataLoaderOptions setCacheMap(CacheMap<?,?> cacheMap)
cacheMap - the cache map instancepublic int maxBatchSize()
BatchLoader function
before they are split into multiple classpublic DataLoaderOptions setMaxBatchSize(int maxBatchSize)
BatchLoader function
before they are split into multiple classmaxBatchSize - the maximum batch sizepublic StatisticsCollector getStatisticsCollector()
public DataLoaderOptions setStatisticsCollector(java.util.function.Supplier<StatisticsCollector> statisticsCollector)
statisticsCollector - the statistics collector to usepublic BatchLoaderContextProvider getBatchLoaderContextProvider()
public DataLoaderOptions setBatchLoaderContextProvider(BatchLoaderContextProvider contextProvider)
contextProvider - the batch loader context providerpublic java.util.Optional<ValueCache<?,?>> valueCache()
If missing, a no-op implementation will be used.
public DataLoaderOptions setValueCache(ValueCache<?,?> valueCache)
valueCache - the value cache instancepublic ValueCacheOptions getValueCacheOptions()
ValueCacheOptions that control how the ValueCache will be usedpublic DataLoaderOptions setValueCacheOptions(ValueCacheOptions valueCacheOptions)
ValueCacheOptions that control how the ValueCache will be usedvalueCacheOptions - the value cache options