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>
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 theCacheLoader
Factory
.- Parameters:
cacheLoaderFactory
- theCacheLoader
Factory
- Returns:
- this
-
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
- Returns:
- this
-
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
- Returns:
- this
- 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
- 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
CacheLoader
Factory
.- Returns:
- this
-
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- Returns:
- this
-
writeThrough
Set that write-through caching should be used.It is an invalid configuration to use this without specifying a
CacheWriter
Factory
.- Returns:
- this
-
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- 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
-true
if store-by-value is required,false
for 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 aCacheConfiguration
based on the values of thisCacheConfiguration.Builder
.- Returns:
- the created configuration
-