Package com.hazelcast.config
Interface CacheConfiguration<K,V>
- Type Parameters:
K- the type of keyV- the type of value
- All Superinterfaces:
javax.cache.configuration.CompleteConfiguration<K,,V> javax.cache.configuration.Configuration<K,,V> Serializable
- All Known Implementing Classes:
AbstractCacheConfig,CacheConfig
public interface CacheConfiguration<K,V>
extends javax.cache.configuration.CompleteConfiguration<K,V>
Mutable extension to
CompleteConfiguration-
Method Summary
Modifier and TypeMethodDescriptionaddCacheEntryListenerConfiguration(javax.cache.configuration.CacheEntryListenerConfiguration<K, V> cacheEntryListenerConfiguration) Add a configuration for aCacheEntryListener.removeCacheEntryListenerConfiguration(javax.cache.configuration.CacheEntryListenerConfiguration<K, V> cacheEntryListenerConfiguration) Remove a configuration for aCacheEntryListener.setCacheLoaderFactory(javax.cache.configuration.Factory<? extends javax.cache.integration.CacheLoader<K, V>> factory) Set theCacheLoaderfactory.setCacheWriterFactory(javax.cache.configuration.Factory<? extends javax.cache.integration.CacheWriter<? super K, ? super V>> factory) Set theCacheWriterfactory.setExpiryPolicyFactory(javax.cache.configuration.Factory<? extends javax.cache.expiry.ExpiryPolicy> factory) Set theFactoryfor theExpiryPolicy.setManagementEnabled(boolean enabled) Sets whether management is enabled on a cache.setReadThrough(boolean isReadThrough) Set if read-through caching should be used.setStatisticsEnabled(boolean enabled) Sets whether statistics gathering is enabled on a cache.setStoreByValue(boolean isStoreByValue) Set if a configured cache should use store-by-value or store-by-reference semantics.Sets the expected type of keys and values for aCacheconfigured with thisConfiguration.setWriteThrough(boolean isWriteThrough) Set if write-through caching should be used.Methods inherited from interface javax.cache.configuration.CompleteConfiguration
getCacheEntryListenerConfigurations, getCacheLoaderFactory, getCacheWriterFactory, getExpiryPolicyFactory, isManagementEnabled, isReadThrough, isStatisticsEnabled, isWriteThroughMethods inherited from interface javax.cache.configuration.Configuration
getKeyType, getValueType, isStoreByValue
-
Method Details
-
setTypes
Sets the expected type of keys and values for aCacheconfigured with thisConfiguration. Setting both toObject.classmeans type-safety checks are not required.This is used by
CacheManagerto ensure that the key and value types are the same as those configured for theCacheprior to returning a requested cache from this method.Implementations may further perform type checking on mutative cache operations and throw a
ClassCastExceptionif these checks fail.- Parameters:
keyType- the expected key typevalueType- the expected value type- Returns:
- the
CacheConfigurationto permit fluent-style method calls - Throws:
NullPointerException- should the key or value type benull- See Also:
-
CacheManager.getCache(String, Class, Class)
-
addCacheEntryListenerConfiguration
CacheConfiguration<K,V> addCacheEntryListenerConfiguration(javax.cache.configuration.CacheEntryListenerConfiguration<K, V> cacheEntryListenerConfiguration) Add a configuration for aCacheEntryListener.- Parameters:
cacheEntryListenerConfiguration- theCacheEntryListenerConfiguration- Returns:
- the
CacheConfigurationto permit fluent-style method calls - Throws:
IllegalArgumentException- if the same CacheEntryListenerConfiguration is used more than once
-
removeCacheEntryListenerConfiguration
CacheConfiguration<K,V> removeCacheEntryListenerConfiguration(javax.cache.configuration.CacheEntryListenerConfiguration<K, V> cacheEntryListenerConfiguration) Remove a configuration for aCacheEntryListener.- Parameters:
cacheEntryListenerConfiguration- theCacheEntryListenerConfigurationto remove- Returns:
- the
CacheConfigurationto permit fluent-style method calls
-
setCacheLoaderFactory
CacheConfiguration<K,V> setCacheLoaderFactory(javax.cache.configuration.Factory<? extends javax.cache.integration.CacheLoader<K, V>> factory) Set theCacheLoaderfactory.- Parameters:
factory- theCacheLoaderFactory- Returns:
- the
CacheConfigurationto permit fluent-style method calls
-
setCacheWriterFactory
CacheConfiguration<K,V> setCacheWriterFactory(javax.cache.configuration.Factory<? extends javax.cache.integration.CacheWriter<? super K, ? super V>> factory) Set theCacheWriterfactory.- Parameters:
factory- theCacheWriterFactory- Returns:
- the
CacheConfigurationto permit fluent-style method calls
-
setExpiryPolicyFactory
CacheConfiguration<K,V> setExpiryPolicyFactory(javax.cache.configuration.Factory<? extends javax.cache.expiry.ExpiryPolicy> factory) Set theFactoryfor theExpiryPolicy. Ifnullis specified the defaultExpiryPolicyis used.- Parameters:
factory- theExpiryPolicyFactory- Returns:
- the
CacheConfigurationto permit fluent-style method calls
-
setReadThrough
Set if read-through caching should be used.It is an invalid configuration to set this to
truewithout specifying aCacheLoaderFactory.- Parameters:
isReadThrough-trueif read-through is required,falseotherwise- Returns:
- the
CacheConfigurationto permit fluent-style method calls
-
setWriteThrough
Set if write-through caching should be used.It is an invalid configuration to set this to
truewithout specifying aCacheWriterFactory.- Parameters:
isWriteThrough-trueif write-through is required,falseotherwise- Returns:
- the
CacheConfigurationto permit fluent-style method calls
-
setStoreByValue
Set if a configured cache should use store-by-value or store-by-reference semantics.- Parameters:
isStoreByValue-trueif store-by-value is required,falsefor store-by-reference- Returns:
- the
CacheConfigurationto permit fluent-style method calls
-
setStatisticsEnabled
Sets whether statistics gathering is enabled on a cache.Statistics may be enabled or disabled at runtime via
CacheManager.enableStatistics(String, boolean).- Parameters:
enabled-trueto enable statistics,falseto disable- Returns:
- the
CacheConfigurationto permit fluent-style method calls
-
setManagementEnabled
Sets whether management is enabled on a cache.Management may be enabled or disabled at runtime via
CacheManager.enableManagement(String, boolean).- Parameters:
enabled-trueto enable management,falseto disable- Returns:
- the
CacheConfigurationto permit fluent-style method calls
-