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 class
CacheConfiguration.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 aCacheConfiguration
based on the values of thisCacheConfiguration.Builder
.CacheConfiguration.Builder<K,V>
cacheLoaderFactory(javax.cache.configuration.Factory<javax.cache.integration.CacheLoader<K,V>> cacheLoaderFactory)
Set theCacheLoader
Factory
.CacheConfiguration.Builder<K,V>
cacheWriterFactory(javax.cache.configuration.Factory<javax.cache.integration.CacheWriter<? super K,? super V>> cacheWriterFactory)
Set theCacheWriter
Factory
.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 theEvictionManager
Factory
.CacheConfiguration.Builder<K,V>
expiryPolicyFactory(javax.cache.configuration.Factory<javax.cache.expiry.ExpiryPolicy> expiryPolicyFactory)
Set theFactory
for 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>
serializerFieldPredicate(Predicate<? super Field> serializerFieldPredicate)
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:
cacheEntryListenerConfiguration
- theCacheEntryListenerConfiguration
-
cacheLoaderFactory
CacheConfiguration.Builder<K,V> cacheLoaderFactory(javax.cache.configuration.Factory<javax.cache.integration.CacheLoader<K,V>> cacheLoaderFactory)Set theCacheLoader
Factory
.- Parameters:
cacheLoaderFactory
- theCacheLoader
Factory
-
cacheWriterFactory
CacheConfiguration.Builder<K,V> cacheWriterFactory(javax.cache.configuration.Factory<javax.cache.integration.CacheWriter<? super K,? super V>> cacheWriterFactory)Set theCacheWriter
Factory
.- Parameters:
cacheWriterFactory
- theCacheWriter
Factory
-
expiryPolicyFactory
CacheConfiguration.Builder<K,V> expiryPolicyFactory(javax.cache.configuration.Factory<javax.cache.expiry.ExpiryPolicy> expiryPolicyFactory)Set theFactory
for theExpiryPolicy
. Ifnull
is specified the defaultExpiryPolicy
is 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
- theExpiryPolicy
Factory
- See Also:
CacheConfiguration.DefaultExpiryPolicyFactory()
-
evictionManagerFactory
CacheConfiguration.Builder<K,V> evictionManagerFactory(javax.cache.configuration.Factory<EvictionManager<K,V>> evictionManagerFactory)Set theEvictionManager
Factory
. Ifnull
is specified the defaultEvictionManager
is 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
- theEvictionManager
Factory
- See Also:
CacheConfiguration.DefaultEvictionManagerFactory()
-
readThrough
Set that read-through caching should be used.It is an invalid configuration to use this without specifying a
CacheLoader
Factory
. -
readThrough
Set if read-through caching should be used.It is an invalid configuration to set this to true without specifying a
CacheLoader
Factory
.- Parameters:
readThrough
-true
if read-through is required
-
writeThrough
Set that write-through caching should be used.It is an invalid configuration to use this without specifying a
CacheWriter
Factory
. -
writeThrough
Set if write-through caching should be used.It is an invalid configuration to set this to true without specifying a
CacheWriter
Factory
.- Parameters:
writeThrough
-true
if write-through is required
-
storeByValue
Set that store-by-value semantics should be used. -
storeByReference
Set that store-by-reference semantics should be used. -
storeByValue
Set if a configured cache should use store-by-value or store-by-reference semantics.- Parameters:
storeByValue
-true
if store-by-value is required,false
for store-by-reference
-
enableStatistics
Enables statistics gathering.Statistics may be enabled or disabled at runtime via
CacheManager.enableStatistics(String,boolean)
orCache.setStatisticsEnabled(boolean)
. -
disableStatistics
Disables statistics gathering.Statistics may be enabled or disabled at runtime via
CacheManager.enableStatistics(String,boolean)
orCache.setStatisticsEnabled(boolean)
. -
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.
-
enableManagement
Enables the management bean.Management may be enabled or disabled at runtime via
CacheManager.enableManagement(String,boolean)
orCache.setManagementEnabled(boolean)
. -
disableManagement
Disables the management bean.Management may be enabled or disabled at runtime via
CacheManager.enableManagement(String,boolean)
orCache.setManagementEnabled(boolean)
. -
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:
enabled
- true to enable statistics, false to disable.
-
serializerFieldPredicate
CacheConfiguration.Builder<K,V> serializerFieldPredicate(Predicate<? super Field> serializerFieldPredicate)Set the SerializerField
Predicate
. Ifnull
is specified the defaultPredicate
is used.Only one predicate can be set for a cache. The last one applied before cache construction will be the one used.
- Parameters:
serializerFieldPredicate
- the SerializerField
Predicate
- See Also:
CacheConfiguration.DefaultSerializerFieldPredicate()
-
build
CacheConfiguration<K,V> build()Builds aCacheConfiguration
based on the values of thisCacheConfiguration.Builder
.
-