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>
,java.io.Serializable
- All Known Implementing Classes:
AbstractCacheConfig
,CacheConfig
public interface CacheConfiguration<K,V> extends javax.cache.configuration.CompleteConfiguration<K,V>
Mutable extension toCompleteConfiguration
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description CacheConfiguration<K,V>
addCacheEntryListenerConfiguration(javax.cache.configuration.CacheEntryListenerConfiguration<K,V> cacheEntryListenerConfiguration)
Add a configuration for aCacheEntryListener
.CacheConfiguration<K,V>
removeCacheEntryListenerConfiguration(javax.cache.configuration.CacheEntryListenerConfiguration<K,V> cacheEntryListenerConfiguration)
Remove a configuration for aCacheEntryListener
.CacheConfiguration<K,V>
setCacheLoaderFactory(javax.cache.configuration.Factory<? extends javax.cache.integration.CacheLoader<K,V>> factory)
Set theCacheLoader
factory.CacheConfiguration<K,V>
setCacheWriterFactory(javax.cache.configuration.Factory<? extends javax.cache.integration.CacheWriter<? super K,? super V>> factory)
Set theCacheWriter
factory.CacheConfiguration<K,V>
setExpiryPolicyFactory(javax.cache.configuration.Factory<? extends javax.cache.expiry.ExpiryPolicy> factory)
Set theFactory
for theExpiryPolicy
.CacheConfiguration<K,V>
setManagementEnabled(boolean enabled)
Sets whether management is enabled on a cache.CacheConfiguration<K,V>
setReadThrough(boolean isReadThrough)
Set if read-through caching should be used.CacheConfiguration<K,V>
setStatisticsEnabled(boolean enabled)
Sets whether statistics gathering is enabled on a cache.CacheConfiguration<K,V>
setStoreByValue(boolean isStoreByValue)
Set if a configured cache should use store-by-value or store-by-reference semantics.CacheConfiguration<K,V>
setTypes(java.lang.Class<K> keyType, java.lang.Class<V> valueType)
Sets the expected type of keys and values for aCache
configured with thisConfiguration
.CacheConfiguration<K,V>
setWriteThrough(boolean isWriteThrough)
Set if write-through caching should be used.
-
-
-
Method Detail
-
setTypes
CacheConfiguration<K,V> setTypes(java.lang.Class<K> keyType, java.lang.Class<V> valueType)
Sets the expected type of keys and values for aCache
configured with thisConfiguration
. Setting both toObject.class
means type-safety checks are not required.This is used by
CacheManager
to ensure that the key and value types are the same as those configured for theCache
prior to returning a requested cache from this method.Implementations may further perform type checking on mutative cache operations and throw a
ClassCastException
if these checks fail.- Parameters:
keyType
- the expected key typevalueType
- the expected value type- Returns:
- the
CacheConfiguration
to permit fluent-style method calls - Throws:
java.lang.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
CacheConfiguration
to permit fluent-style method calls - Throws:
java.lang.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
- theCacheEntryListenerConfiguration
to remove- Returns:
- the
CacheConfiguration
to permit fluent-style method calls
-
setCacheLoaderFactory
CacheConfiguration<K,V> setCacheLoaderFactory(javax.cache.configuration.Factory<? extends javax.cache.integration.CacheLoader<K,V>> factory)
Set theCacheLoader
factory.- Parameters:
factory
- theCacheLoader
Factory
- Returns:
- the
CacheConfiguration
to 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 theCacheWriter
factory.- Parameters:
factory
- theCacheWriter
Factory
- Returns:
- the
CacheConfiguration
to permit fluent-style method calls
-
setExpiryPolicyFactory
CacheConfiguration<K,V> setExpiryPolicyFactory(javax.cache.configuration.Factory<? extends javax.cache.expiry.ExpiryPolicy> factory)
Set theFactory
for theExpiryPolicy
. Ifnull
is specified the defaultExpiryPolicy
is used.- Parameters:
factory
- theExpiryPolicy
Factory
- Returns:
- the
CacheConfiguration
to permit fluent-style method calls
-
setReadThrough
CacheConfiguration<K,V> setReadThrough(boolean isReadThrough)
Set if read-through caching should be used.It is an invalid configuration to set this to
true
without specifying aCacheLoader
Factory
.- Parameters:
isReadThrough
-true
if read-through is required,false
otherwise- Returns:
- the
CacheConfiguration
to permit fluent-style method calls
-
setWriteThrough
CacheConfiguration<K,V> setWriteThrough(boolean isWriteThrough)
Set if write-through caching should be used.It is an invalid configuration to set this to
true
without specifying aCacheWriter
Factory
.- Parameters:
isWriteThrough
-true
if write-through is required,false
otherwise- Returns:
- the
CacheConfiguration
to permit fluent-style method calls
-
setStoreByValue
CacheConfiguration<K,V> setStoreByValue(boolean isStoreByValue)
Set if a configured cache should use store-by-value or store-by-reference semantics.- Parameters:
isStoreByValue
-true
if store-by-value is required,false
for store-by-reference- Returns:
- the
CacheConfiguration
to permit fluent-style method calls
-
setStatisticsEnabled
CacheConfiguration<K,V> setStatisticsEnabled(boolean enabled)
Sets whether statistics gathering is enabled on a cache.Statistics may be enabled or disabled at runtime via
CacheManager.enableStatistics(String, boolean)
.- Parameters:
enabled
-true
to enable statistics,false
to disable- Returns:
- the
CacheConfiguration
to permit fluent-style method calls
-
setManagementEnabled
CacheConfiguration<K,V> setManagementEnabled(boolean enabled)
Sets whether management is enabled on a cache.Management may be enabled or disabled at runtime via
CacheManager.enableManagement(String, boolean)
.- Parameters:
enabled
-true
to enable management,false
to disable- Returns:
- the
CacheConfiguration
to permit fluent-style method calls
-
-