Interface CacheConfiguration.Builder<K,V>
- All Known Implementing Classes:
CacheConfiguration.Builder.Default
- Enclosing interface:
- CacheConfiguration<K,V>
public static interface CacheConfiguration.Builder<K,V>
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static classCacheConfiguration.Builder.Default<K,V> -
Method Summary
Modifier and Type Method Description CacheConfiguration.Builder<K,V>addListenerConfiguration(javax.cache.configuration.CacheEntryListenerConfiguration<K,V> listenerConfiguration)Add a configuration for aCacheEntryListener.CacheConfiguration<K,V>build()Builds aCacheConfigurationbased on the values of thisCacheConfiguration.Builder.CacheConfiguration.Builder<K,V>cacheLoaderFactory(javax.cache.configuration.Factory<javax.cache.integration.CacheLoader<K,V>> cacheLoaderFactory)Set theCacheLoaderFactory.CacheConfiguration.Builder<K,V>cacheWriterFactory(javax.cache.configuration.Factory<javax.cache.integration.CacheWriter<? super K,? super V>> cacheWriterFactory)Set theCacheWriterFactory.default CacheConfiguration.Builder<K,V>disableManagement()Disables the management bean.default CacheConfiguration.Builder<K,V>disableStatistics()Disables statistics gathering.default CacheConfiguration.Builder<K,V>enableManagement()Enables the management bean.CacheConfiguration.Builder<K,V>enableManagement(boolean managementEnabled)Sets whether the management bean is enabled.default CacheConfiguration.Builder<K,V>enableStatistics()Enables statistics gathering.CacheConfiguration.Builder<K,V>enableStatistics(boolean statisticsEnabled)Sets whether statistics gathering is enabled.CacheConfiguration.Builder<K,V>evictionManagerFactory(javax.cache.configuration.Factory<EvictionManager<K,V>> evictionManagerFactory)Set theEvictionManagerFactory.CacheConfiguration.Builder<K,V>expiryPolicyFactory(javax.cache.configuration.Factory<javax.cache.expiry.ExpiryPolicy> expiryPolicyFactory)Set theFactoryfor theExpiryPolicy.default CacheConfiguration.Builder<K,V>readThrough()Set that read-through caching should be used.CacheConfiguration.Builder<K,V>readThrough(boolean readThrough)Set if read-through caching should be used.CacheConfiguration.Builder<K,V>serializerFoundation(SerializerFoundation<?> serializerFoundation)Set the serializer foundation.default CacheConfiguration.Builder<K,V>storeByReference()Set that store-by-reference semantics should be used.default CacheConfiguration.Builder<K,V>storeByValue()Set that store-by-value semantics should be used.CacheConfiguration.Builder<K,V>storeByValue(boolean storeByValue)Set if a configured cache should use store-by-value or store-by-reference semantics.default CacheConfiguration.Builder<K,V>writeThrough()Set that write-through caching should be used.CacheConfiguration.Builder<K,V>writeThrough(boolean writeThrough)Set if write-through caching should be used.
-
Method Details
-
addListenerConfiguration
CacheConfiguration.Builder<K,V> addListenerConfiguration(javax.cache.configuration.CacheEntryListenerConfiguration<K,V> listenerConfiguration)Add a configuration for aCacheEntryListener.- Parameters:
listenerConfiguration- theCacheEntryListenerConfiguration- Returns:
- this
-
cacheLoaderFactory
CacheConfiguration.Builder<K,V> cacheLoaderFactory(javax.cache.configuration.Factory<javax.cache.integration.CacheLoader<K,V>> cacheLoaderFactory)Set theCacheLoaderFactory.- Parameters:
cacheLoaderFactory- theCacheLoaderFactory- Returns:
- this
-
cacheWriterFactory
CacheConfiguration.Builder<K,V> cacheWriterFactory(javax.cache.configuration.Factory<javax.cache.integration.CacheWriter<? super K,? super V>> cacheWriterFactory)Set theCacheWriterFactory.- Parameters:
cacheWriterFactory- theCacheWriterFactory- Returns:
- this
-
expiryPolicyFactory
CacheConfiguration.Builder<K,V> expiryPolicyFactory(javax.cache.configuration.Factory<javax.cache.expiry.ExpiryPolicy> expiryPolicyFactory)Set theFactoryfor theExpiryPolicy. Ifnullis specified the defaultExpiryPolicyis used.Only one expiry policy can be set for a cache. The last policy applied before cache construction will be the one used.
- Parameters:
expiryPolicyFactory- theExpiryPolicyFactory- Returns:
- this
- See Also:
CacheConfiguration.DefaultExpiryPolicyFactory()
-
evictionManagerFactory
CacheConfiguration.Builder<K,V> evictionManagerFactory(javax.cache.configuration.Factory<EvictionManager<K,V>> evictionManagerFactory)Set theEvictionManagerFactory. Ifnullis specified the defaultEvictionManageris used.Only one eviction manager can be set for a cache. The last manager applied before cache construction will be the one used.
- Parameters:
evictionManagerFactory- theEvictionManagerFactory- Returns:
- this
- See Also:
CacheConfiguration.DefaultEvictionManagerFactory()
-
readThrough
Set that read-through caching should be used.It is an invalid configuration to use this without specifying a
CacheLoaderFactory.- Returns:
- this
-
readThrough
Set if read-through caching should be used.It is an invalid configuration to set this to true without specifying a
CacheLoaderFactory.- Parameters:
readThrough-trueif read-through is required- Returns:
- this
-
writeThrough
Set that write-through caching should be used.It is an invalid configuration to use this without specifying a
CacheWriterFactory.- Returns:
- this
-
writeThrough
Set if write-through caching should be used.It is an invalid configuration to set this to true without specifying a
CacheWriterFactory.- Parameters:
writeThrough-trueif write-through is required- Returns:
- this
-
storeByValue
Set that store-by-value semantics should be used.- Returns:
- this
-
storeByReference
Set that store-by-reference semantics should be used.- Returns:
- this
-
storeByValue
Set if a configured cache should use store-by-value or store-by-reference semantics.- Parameters:
storeByValue-trueif store-by-value is required,falsefor store-by-reference- Returns:
- this
-
enableStatistics
Enables statistics gathering.Statistics may be enabled or disabled at runtime via
CacheManager.enableStatistics(String, boolean)orCache.setStatisticsEnabled(boolean).- Returns:
- this
-
disableStatistics
Disables statistics gathering.Statistics may be enabled or disabled at runtime via
CacheManager.enableStatistics(String, boolean)orCache.setStatisticsEnabled(boolean).- Returns:
- this
-
enableStatistics
Sets whether statistics gathering is enabled.Statistics may be enabled or disabled at runtime via
CacheManager.enableStatistics(String, boolean)orCache.setStatisticsEnabled(boolean).- Parameters:
statisticsEnabled- true to enable statistics, false to disable.- Returns:
- this
-
enableManagement
Enables the management bean.Management may be enabled or disabled at runtime via
CacheManager.enableManagement(String, boolean)orCache.setManagementEnabled(boolean).- Returns:
- this
-
disableManagement
Disables the management bean.Management may be enabled or disabled at runtime via
CacheManager.enableManagement(String, boolean)orCache.setManagementEnabled(boolean).- Returns:
- this
-
enableManagement
Sets whether the management bean is enabled.Management may be enabled or disabled at runtime via
CacheManager.enableManagement(String, boolean)orCache.setManagementEnabled(boolean).- Parameters:
managementEnabled- true to enable statistics, false to disable.- Returns:
- this
-
serializerFoundation
CacheConfiguration.Builder<K,V> serializerFoundation(SerializerFoundation<?> serializerFoundation)Set the serializer foundation.- Parameters:
serializerFoundation- the foundation which the serializer will be based on- Returns:
- this
-
build
CacheConfiguration<K,V> build()Builds aCacheConfigurationbased on the values of thisCacheConfiguration.Builder.- Returns:
- the created configuration
-