K - the key typeV - the value typepublic class CacheConfig<K,V> extends Object
ICache.| Modifier and Type | Field and Description |
|---|---|
protected javax.cache.configuration.Factory<javax.cache.integration.CacheLoader<K,V>> |
cacheLoaderFactory
The
Factory for the CacheLoader. |
protected javax.cache.configuration.Factory<javax.cache.integration.CacheWriter<? super K,? super V>> |
cacheWriterFactory
The
Factory for the CacheWriter. |
protected javax.cache.configuration.Factory<javax.cache.expiry.ExpiryPolicy> |
expiryPolicyFactory
The
Factory for the ExpiryPolicy. |
protected HotRestartConfig |
hotRestartConfig |
protected boolean |
isManagementEnabled
Whether management is enabled
|
protected boolean |
isReadThrough
A flag indicating if "read-through" mode is required.
|
protected boolean |
isStatisticsEnabled
A flag indicating if statistics gathering is enabled.
|
protected boolean |
isStoreByValue
A flag indicating if the cache will be store-by-value or store-by-reference.
|
protected boolean |
isWriteThrough
A flag indicating if "write-through" mode is required.
|
protected Class<K> |
keyType
The type of keys for
Caches configured with this
Configuration. |
protected Set<javax.cache.configuration.CacheEntryListenerConfiguration<K,V>> |
listenerConfigurations
The
CacheEntryListenerConfigurations for the Configuration. |
protected Class<V> |
valueType
The type of values for
Caches configured with this
Configuration. |
| Constructor and Description |
|---|
CacheConfig() |
CacheConfig(CacheSimpleConfig simpleConfig) |
CacheConfig(javax.cache.configuration.CompleteConfiguration<K,V> configuration) |
CacheConfig(String name) |
| Modifier and Type | Method and Description |
|---|---|
CacheConfiguration<K,V> |
addCacheEntryListenerConfiguration(javax.cache.configuration.CacheEntryListenerConfiguration<K,V> cacheEntryListenerConfiguration)
Add a configuration for a
CacheEntryListener. |
protected Set<javax.cache.configuration.CacheEntryListenerConfiguration<K,V>> |
createConcurrentSet() |
boolean |
equals(Object o) |
CacheConfigReadOnly<K,V> |
getAsReadOnly()
Deprecated.
this method will be removed in 4.0; it is meant for internal usage only
|
int |
getAsyncBackupCount()
Gets the number of asynchronous backups for this
ICache. |
int |
getBackupCount()
Gets the number of synchronous backups for this
ICache. |
Iterable<javax.cache.configuration.CacheEntryListenerConfiguration<K,V>> |
getCacheEntryListenerConfigurations() |
javax.cache.configuration.Factory<javax.cache.integration.CacheLoader<K,V>> |
getCacheLoaderFactory() |
javax.cache.configuration.Factory<javax.cache.integration.CacheWriter<? super K,? super V>> |
getCacheWriterFactory() |
CacheEvictionConfig |
getEvictionConfig()
Gets the
EvictionConfig instance of the eviction configuration for this ICache. |
javax.cache.configuration.Factory<javax.cache.expiry.ExpiryPolicy> |
getExpiryPolicyFactory() |
HotRestartConfig |
getHotRestartConfig()
Gets the
HotRestartConfig for this CacheConfiguration |
InMemoryFormat |
getInMemoryFormat()
Gets the data type that will be used to store records.
|
Class<K> |
getKeyType() |
String |
getManagerPrefix()
Gets the manager prefix of the
ICache, such as "hz://". |
String |
getMergePolicy()
Gets the class name of
CacheMergePolicy implementation of this cache config. |
String |
getName()
Gets the name of this
ICache. |
String |
getNameWithPrefix()
Gets the full name of the
ICache, including the manager scope prefix. |
List<CachePartitionLostListenerConfig> |
getPartitionLostListenerConfigs()
Gets the partition lost listener references added to cache configuration.
|
String |
getQuorumName()
Gets the name of the associated quorum if any.
|
int |
getTotalBackupCount()
Gets the total backup count (
backupCount + asyncBackupCount) of the cache. |
String |
getUriString()
Gets the URI string which is the global identifier for this
ICache. |
Class<V> |
getValueType() |
WanReplicationRef |
getWanReplicationRef() |
int |
hashCode() |
boolean |
isDisablePerEntryInvalidationEvents()
Returns invalidation events disabled status for per entry.
|
boolean |
isManagementEnabled() |
boolean |
isReadThrough() |
boolean |
isStatisticsEnabled() |
boolean |
isStoreByValue() |
boolean |
isWriteThrough() |
void |
readData(ObjectDataInput in)
Reads fields from the input stream
|
CacheConfiguration<K,V> |
removeCacheEntryListenerConfiguration(javax.cache.configuration.CacheEntryListenerConfiguration<K,V> cacheEntryListenerConfiguration)
Remove a configuration for a
CacheEntryListener. |
CacheConfig<K,V> |
setAsyncBackupCount(int asyncBackupCount)
Sets the number of asynchronous backups for this
ICache. |
CacheConfig<K,V> |
setBackupCount(int backupCount)
Sets the number of synchronous backups.
|
CacheConfiguration<K,V> |
setCacheLoaderFactory(javax.cache.configuration.Factory<? extends javax.cache.integration.CacheLoader<K,V>> cacheLoaderFactory)
Set the
CacheLoader factory. |
CacheConfiguration<K,V> |
setCacheWriterFactory(javax.cache.configuration.Factory<? extends javax.cache.integration.CacheWriter<? super K,? super V>> cacheWriterFactory)
Set the
CacheWriter factory. |
void |
setDisablePerEntryInvalidationEvents(boolean disablePerEntryInvalidationEvents)
Sets invalidation events disabled status for per entry.
|
CacheConfig<K,V> |
setEvictionConfig(EvictionConfig evictionConfig)
Sets the
EvictionConfig instance for eviction configuration for this ICache. |
CacheConfiguration<K,V> |
setExpiryPolicyFactory(javax.cache.configuration.Factory<? extends javax.cache.expiry.ExpiryPolicy> expiryPolicyFactory)
Set the
Factory for the ExpiryPolicy. |
CacheConfiguration<K,V> |
setHotRestartConfig(HotRestartConfig hotRestartConfig)
Sets the
HotRestartConfig for this CacheConfiguration |
CacheConfig<K,V> |
setInMemoryFormat(InMemoryFormat inMemoryFormat)
Data type that will be used to store records in this
ICache. |
CacheConfiguration<K,V> |
setKeyType(Class<K> keyType) |
CacheConfiguration<K,V> |
setListenerConfigurations() |
CacheConfiguration<K,V> |
setManagementEnabled(boolean enabled)
Sets whether or not management is enabled on this cache.
|
CacheConfig<K,V> |
setManagerPrefix(String managerPrefix)
Sets the manager prefix of the
ICache. |
void |
setMergePolicy(String mergePolicy)
Sets the class name of
CacheMergePolicy implementation to this cache config. |
CacheConfig<K,V> |
setName(String name)
Sets the name of this
ICache. |
CacheConfig<K,V> |
setPartitionLostListenerConfigs(List<CachePartitionLostListenerConfig> partitionLostListenerConfigs)
Sets the WAN target replication reference.
|
CacheConfig<K,V> |
setQuorumName(String quorumName)
Associates this cache configuration to a quorum.
|
CacheConfiguration<K,V> |
setReadThrough(boolean isReadThrough)
Set if read-through caching should be used.
|
CacheConfiguration<K,V> |
setStatisticsEnabled(boolean enabled)
Sets whether or not statistics gathering is enabled on this cache.
|
CacheConfiguration<K,V> |
setStoreByValue(boolean storeByValue)
Set if a configured cache should use store-by-value or store-by-reference
semantics.
|
CacheConfiguration<K,V> |
setTypes(Class<K> keyType,
Class<V> valueType)
Sets the expected type of keys and values for a
Cache
configured with this Configuration. |
CacheConfig<K,V> |
setUriString(String uriString)
Sets the URI string, which is the global identifier of the
ICache. |
CacheConfiguration<K,V> |
setValueType(Class<V> valueType) |
CacheConfig<K,V> |
setWanReplicationRef(WanReplicationRef wanReplicationRef) |
CacheConfiguration<K,V> |
setWriteThrough(boolean isWriteThrough)
Set if write-through caching should be used.
|
String |
toString() |
void |
writeData(ObjectDataOutput out)
Writes object fields to output stream
|
protected Set<javax.cache.configuration.CacheEntryListenerConfiguration<K,V>> listenerConfigurations
CacheEntryListenerConfigurations for the Configuration.protected Class<K> keyType
Caches configured with this
Configuration.protected Class<V> valueType
Caches configured with this
Configuration.protected javax.cache.configuration.Factory<javax.cache.integration.CacheLoader<K,V>> cacheLoaderFactory
Factory for the CacheLoader.protected javax.cache.configuration.Factory<javax.cache.integration.CacheWriter<? super K,? super V>> cacheWriterFactory
Factory for the CacheWriter.protected javax.cache.configuration.Factory<javax.cache.expiry.ExpiryPolicy> expiryPolicyFactory
Factory for the ExpiryPolicy.protected boolean isReadThrough
protected boolean isWriteThrough
protected boolean isStatisticsEnabled
protected boolean isStoreByValue
protected boolean isManagementEnabled
protected HotRestartConfig hotRestartConfig
public CacheConfig()
public CacheConfig(String name)
public CacheConfig(CacheSimpleConfig simpleConfig) throws Exception
Exceptionpublic CacheConfigReadOnly<K,V> getAsReadOnly()
public CacheConfig<K,V> setName(String name)
ICache.name - the name to set for this ICachepublic String getManagerPrefix()
ICache, such as "hz://".ICachepublic CacheConfig<K,V> setManagerPrefix(String managerPrefix)
ICache.managerPrefix - the manager prefix to set for this ICachepublic String getUriString()
ICache.ICachepublic CacheConfig<K,V> setUriString(String uriString)
ICache.uriString - the URI string to set for this ICachepublic String getNameWithPrefix()
ICache, including the manager scope prefix.ICache, including the manager scope prefixpublic int getBackupCount()
ICache.ICachegetAsyncBackupCount()public CacheConfig<K,V> setBackupCount(int backupCount)
backupCount - the number of synchronous backups to set for this ICacheIllegalArgumentException - if backupCount smaller than 0,
or larger than the maximum number of backup,
or the sum of the synchronous and asynchronous backups is larger than
the maximum number of backupssetAsyncBackupCount(int)public int getAsyncBackupCount()
ICache.ICachesetBackupCount(int)public CacheConfig<K,V> setAsyncBackupCount(int asyncBackupCount)
ICache.asyncBackupCount - the number of asynchronous backups to set for this ICacheIllegalArgumentException - if asyncBackupCount is smaller than 0,
or larger than the maximum number of backups,
or the sum of the synchronous and asynchronous backups is larger
than the maximum number of backupssetBackupCount(int),
getAsyncBackupCount()public int getTotalBackupCount()
backupCount + asyncBackupCount) of the cache.backupCount + asyncBackupCount) of the cachepublic CacheEvictionConfig getEvictionConfig()
EvictionConfig instance of the eviction configuration for this ICache.EvictionConfig instance of the eviction configurationpublic CacheConfig<K,V> setEvictionConfig(EvictionConfig evictionConfig)
EvictionConfig instance for eviction configuration for this ICache.evictionConfig - the EvictionConfig instance to set for the eviction configurationpublic WanReplicationRef getWanReplicationRef()
public CacheConfig<K,V> setWanReplicationRef(WanReplicationRef wanReplicationRef)
public List<CachePartitionLostListenerConfig> getPartitionLostListenerConfigs()
public CacheConfig<K,V> setPartitionLostListenerConfigs(List<CachePartitionLostListenerConfig> partitionLostListenerConfigs)
partitionLostListenerConfigs - CachePartitionLostListenerConfig listpublic InMemoryFormat getInMemoryFormat()
public CacheConfig<K,V> setInMemoryFormat(InMemoryFormat inMemoryFormat)
ICache.
Possible values:
inMemoryFormat - the record type to setIllegalArgumentException - if inMemoryFormat is nullpublic String getQuorumName()
public CacheConfig<K,V> setQuorumName(String quorumName)
quorumName - name of the desired quorumpublic String getMergePolicy()
CacheMergePolicy implementation of this cache config.CacheMergePolicy implementation of this cache configpublic void setMergePolicy(String mergePolicy)
CacheMergePolicy implementation to this cache config.mergePolicy - the class name of CacheMergePolicy implementation to be set to this cache
configpublic boolean isDisablePerEntryInvalidationEvents()
true if invalidation events are disabled for per entry, false otherwisepublic void setDisablePerEntryInvalidationEvents(boolean disablePerEntryInvalidationEvents)
disablePerEntryInvalidationEvents - disables invalidation event sending behaviour if it is true,
otherwise enables itpublic void writeData(ObjectDataOutput out) throws IOException
DataSerializableout - outputIOExceptionpublic void readData(ObjectDataInput in) throws IOException
DataSerializablein - inputIOExceptionpublic int hashCode()
public boolean equals(Object o)
public CacheConfiguration<K,V> addCacheEntryListenerConfiguration(javax.cache.configuration.CacheEntryListenerConfiguration<K,V> cacheEntryListenerConfiguration)
CacheEntryListener.addCacheEntryListenerConfiguration in interface CacheConfiguration<K,V>cacheEntryListenerConfiguration - the CacheEntryListenerConfigurationCacheConfigIllegalArgumentException - if the same CacheEntryListenerConfiguration
is used more than oncepublic CacheConfiguration<K,V> removeCacheEntryListenerConfiguration(javax.cache.configuration.CacheEntryListenerConfiguration<K,V> cacheEntryListenerConfiguration)
CacheEntryListener.removeCacheEntryListenerConfiguration in interface CacheConfiguration<K,V>cacheEntryListenerConfiguration - the CacheEntryListenerConfiguration to removeCacheConfigpublic Iterable<javax.cache.configuration.CacheEntryListenerConfiguration<K,V>> getCacheEntryListenerConfigurations()
getCacheEntryListenerConfigurations in interface javax.cache.configuration.CompleteConfiguration<K,V>public boolean isReadThrough()
isReadThrough in interface javax.cache.configuration.CompleteConfiguration<K,V>public CacheConfiguration<K,V> setReadThrough(boolean isReadThrough)
CacheConfiguration
It is an invalid configuration to set this to true without specifying a
CacheLoader Factory.
setReadThrough in interface CacheConfiguration<K,V>isReadThrough - true if read-through is required, false otherwiseCacheConfiguration to permit fluent-style method callspublic boolean isWriteThrough()
isWriteThrough in interface javax.cache.configuration.CompleteConfiguration<K,V>public CacheConfiguration<K,V> setWriteThrough(boolean isWriteThrough)
CacheConfiguration
It is an invalid configuration to set this to true without specifying a
CacheWriter Factory.
setWriteThrough in interface CacheConfiguration<K,V>isWriteThrough - true if write-through is required, false otherwiseCacheConfiguration to permit fluent-style method callspublic boolean isStatisticsEnabled()
isStatisticsEnabled in interface javax.cache.configuration.CompleteConfiguration<K,V>public CacheConfiguration<K,V> setStatisticsEnabled(boolean enabled)
Statistics may be enabled or disabled at runtime via CacheManager.enableStatistics(String, boolean).
setStatisticsEnabled in interface CacheConfiguration<K,V>enabled - true to enable statistics, false to disableCacheConfigpublic boolean isManagementEnabled()
isManagementEnabled in interface javax.cache.configuration.CompleteConfiguration<K,V>public CacheConfiguration<K,V> setManagementEnabled(boolean enabled)
Management may be enabled or disabled at runtime via CacheManager.enableManagement(String, boolean).
setManagementEnabled in interface CacheConfiguration<K,V>enabled - true to enable statistics, false to disableCacheConfigpublic HotRestartConfig getHotRestartConfig()
HotRestartConfig for this CacheConfigurationpublic CacheConfiguration<K,V> setHotRestartConfig(HotRestartConfig hotRestartConfig)
HotRestartConfig for this CacheConfigurationhotRestartConfig - hot restart configCacheConfiguration instancepublic javax.cache.configuration.Factory<javax.cache.integration.CacheLoader<K,V>> getCacheLoaderFactory()
getCacheLoaderFactory in interface javax.cache.configuration.CompleteConfiguration<K,V>public CacheConfiguration<K,V> setCacheLoaderFactory(javax.cache.configuration.Factory<? extends javax.cache.integration.CacheLoader<K,V>> cacheLoaderFactory)
CacheConfigurationCacheLoader factory.setCacheLoaderFactory in interface CacheConfiguration<K,V>cacheLoaderFactory - the CacheLoader FactoryCacheConfiguration to permit fluent-style method callspublic CacheConfiguration<K,V> setExpiryPolicyFactory(javax.cache.configuration.Factory<? extends javax.cache.expiry.ExpiryPolicy> expiryPolicyFactory)
CacheConfigurationFactory for the ExpiryPolicy.
If null is specified the default ExpiryPolicy is used.setExpiryPolicyFactory in interface CacheConfiguration<K,V>expiryPolicyFactory - the ExpiryPolicy FactoryCacheConfiguration to permit fluent-style method callspublic CacheConfiguration<K,V> setCacheWriterFactory(javax.cache.configuration.Factory<? extends javax.cache.integration.CacheWriter<? super K,? super V>> cacheWriterFactory)
CacheConfigurationCacheWriter factory.setCacheWriterFactory in interface CacheConfiguration<K,V>cacheWriterFactory - the CacheWriter FactoryCacheConfiguration to permit fluent-style method callspublic javax.cache.configuration.Factory<javax.cache.integration.CacheWriter<? super K,? super V>> getCacheWriterFactory()
getCacheWriterFactory in interface javax.cache.configuration.CompleteConfiguration<K,V>public javax.cache.configuration.Factory<javax.cache.expiry.ExpiryPolicy> getExpiryPolicyFactory()
getExpiryPolicyFactory in interface javax.cache.configuration.CompleteConfiguration<K,V>public Class<K> getKeyType()
getKeyType in interface javax.cache.configuration.Configuration<K,V>public Class<V> getValueType()
getValueType in interface javax.cache.configuration.Configuration<K,V>public CacheConfiguration<K,V> setTypes(Class<K> keyType, Class<V> valueType)
Cache
configured with this Configuration.
Setting both to Object.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 the Cache 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.
setTypes in interface CacheConfiguration<K,V>keyType - the expected key typevalueType - the expected value typeCacheConfigNullPointerException - should the key or value type be nullCacheManager.getCache(String, Class, Class)public boolean isStoreByValue()
isStoreByValue in interface javax.cache.configuration.Configuration<K,V>public CacheConfiguration<K,V> setStoreByValue(boolean storeByValue)
setStoreByValue in interface CacheConfiguration<K,V>storeByValue - true if store-by-value is required,
false for store-by-referenceCacheConfigprotected Set<javax.cache.configuration.CacheEntryListenerConfiguration<K,V>> createConcurrentSet()
public CacheConfiguration<K,V> setKeyType(Class<K> keyType)
public CacheConfiguration<K,V> setValueType(Class<V> valueType)
public CacheConfiguration<K,V> setListenerConfigurations()
Copyright © 2017 Hazelcast, Inc.. All Rights Reserved.