Package com.hazelcast.config
Class CacheSimpleConfig
- java.lang.Object
-
- com.hazelcast.config.CacheSimpleConfig
-
- All Implemented Interfaces:
NamedConfig
,DataSerializable
,IdentifiedDataSerializable
,com.hazelcast.nio.serialization.impl.Versioned
public class CacheSimpleConfig extends java.lang.Object implements IdentifiedDataSerializable, NamedConfig, com.hazelcast.nio.serialization.impl.Versioned
Simple configuration to hold parsed XML configuration. CacheConfig depends on the JCache API. If the JCache API is not in the classpath, you can use CacheSimpleConfig as a communicator between the code and CacheConfig.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
CacheSimpleConfig.ExpiryPolicyFactoryConfig
Represents configuration for "ExpiryPolicyFactory".
-
Field Summary
Fields Modifier and Type Field Description static int
DEFAULT_BACKUP_COUNT
The default number of backups.static InMemoryFormat
DEFAULT_IN_MEMORY_FORMAT
Default InMemory Format.static int
MAX_BACKUP_COUNT
The maximum number of backups.static int
MIN_BACKUP_COUNT
The minimum number of backups.
-
Constructor Summary
Constructors Constructor Description CacheSimpleConfig()
CacheSimpleConfig(CacheSimpleConfig cacheSimpleConfig)
CacheSimpleConfig(java.lang.String name)
Create a Cache Simple Config for a cache with a specific name.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description CacheSimpleConfig
addCachePartitionLostListenerConfig(CachePartitionLostListenerConfig listenerConfig)
Adds the CachePartitionLostListenerConfig to partitionLostListenerConfigs.CacheSimpleConfig
addEntryListenerConfig(CacheSimpleEntryListenerConfig listenerConfig)
AddsCacheSimpleEntryListenerConfig
to thisICache
.boolean
equals(java.lang.Object o)
int
getAsyncBackupCount()
Gets the number of asynchronous backups for thisICache
.int
getBackupCount()
Gets the number of synchronous backups for thisICache
.java.util.List<CacheSimpleEntryListenerConfig>
getCacheEntryListeners()
Gets a list ofCacheSimpleEntryListenerConfig
from thisICache
.java.lang.String
getCacheLoader()
Get classname of a class to be used asCacheLoader
.java.lang.String
getCacheLoaderFactory()
Gets the factory for theCacheLoader
.java.lang.String
getCacheWriter()
Get classname of a class to be used asCacheWriter
.java.lang.String
getCacheWriterFactory()
Gets the factory for theCacheWriter
.int
getClassId()
Returns type identifier for this class.DataPersistenceConfig
getDataPersistenceConfig()
Gets theDataPersistenceConfig
for thisCacheSimpleConfig
EventJournalConfig
getEventJournalConfig()
Gets theEventJournalConfig
for thisCacheSimpleConfig
EvictionConfig
getEvictionConfig()
Gets the eviction configuration for thisICache
.CacheSimpleConfig.ExpiryPolicyFactoryConfig
getExpiryPolicyFactoryConfig()
Gets the factory configuration for theExpiryPolicy
.int
getFactoryId()
Returns DataSerializableFactory factory ID for this class.HotRestartConfig
getHotRestartConfig()
Gets theHotRestartConfig
for thisCacheSimpleConfig
InMemoryFormat
getInMemoryFormat()
Gets the InMemory Format for thisICache
.java.lang.String
getKeyType()
Gets the key type for thisICache
.MergePolicyConfig
getMergePolicyConfig()
Gets theMergePolicyConfig
for this map.MerkleTreeConfig
getMerkleTreeConfig()
Gets theMerkleTreeConfig
for thisCacheSimpleConfig
java.lang.String
getName()
Gets the name of thisICache
.java.util.List<CachePartitionLostListenerConfig>
getPartitionLostListenerConfigs()
Gets the partition lost listener references added to cache configuration.java.lang.String
getSplitBrainProtectionName()
Gets the name of the associated split brain protection if any.java.lang.String
getValueType()
Gets the value type for thisICache
.WanReplicationRef
getWanReplicationRef()
Gets the WAN target replication reference.int
hashCode()
boolean
isDisablePerEntryInvalidationEvents()
Returns invalidation events disabled status for per entry.boolean
isManagementEnabled()
Checks if management is enabled for thisICache
.boolean
isReadThrough()
Checks if thisICache
is read-through: a read loads the entry from the data store if it is not already in the cache.boolean
isStatisticsEnabled()
Checks if statistics are enabled for thisICache
.boolean
isWriteThrough()
Checks if theICache
is write-through: a write to the queue also loads the entry into the data store.void
readData(ObjectDataInput in)
Reads fields from the input streamCacheSimpleConfig
setAsyncBackupCount(int asyncBackupCount)
Sets the number of asynchronous backups for thisICache
.CacheSimpleConfig
setBackupCount(int backupCount)
Sets the number of synchronous backups for thisICache
.CacheSimpleConfig
setCacheEntryListeners(java.util.List<CacheSimpleEntryListenerConfig> cacheEntryListeners)
Sets a list ofCacheSimpleEntryListenerConfig
for thisICache
.CacheSimpleConfig
setCacheLoader(java.lang.String cacheLoader)
Set classname of a class to be used asCacheLoader
.CacheSimpleConfig
setCacheLoaderFactory(java.lang.String cacheLoaderFactory)
Sets the factory for thisCacheLoader
.CacheSimpleConfig
setCacheWriter(java.lang.String cacheWriter)
Set classname of a class to be used asCacheWriter
.CacheSimpleConfig
setCacheWriterFactory(java.lang.String cacheWriterFactory)
Sets the factory for thisCacheWriter
.CacheSimpleConfig
setDataPersistenceConfig(DataPersistenceConfig dataPersistenceConfig)
Sets theDataPersistenceConfig
for thisCacheSimpleConfig
CacheSimpleConfig
setDisablePerEntryInvalidationEvents(boolean disablePerEntryInvalidationEvents)
Sets invalidation events disabled status for per entry.CacheSimpleConfig
setEventJournalConfig(EventJournalConfig eventJournalConfig)
Sets theEventJournalConfig
for thisCacheSimpleConfig
CacheSimpleConfig
setEvictionConfig(EvictionConfig evictionConfig)
Sets the eviction configuration for thisICache
.CacheSimpleConfig
setExpiryPolicyFactory(java.lang.String className)
Sets the factory for thisExpiryPolicy
.CacheSimpleConfig
setExpiryPolicyFactoryConfig(CacheSimpleConfig.ExpiryPolicyFactoryConfig expiryPolicyFactoryConfig)
Sets the factory configuration for thisExpiryPolicy
.CacheSimpleConfig
setHotRestartConfig(HotRestartConfig hotRestartConfig)
Deprecated.since 5.0 usesetDataPersistenceConfig(DataPersistenceConfig)
CacheSimpleConfig
setInMemoryFormat(InMemoryFormat inMemoryFormat)
Sets the InMemory Format for thisICache
.CacheSimpleConfig
setKeyType(java.lang.String keyType)
Sets the key type for thisICache
.CacheSimpleConfig
setManagementEnabled(boolean managementEnabled)
Sets management to enabled or disabled for thisICache
.CacheSimpleConfig
setMergePolicyConfig(MergePolicyConfig mergePolicyConfig)
Sets theMergePolicyConfig
for this map.CacheSimpleConfig
setMerkleTreeConfig(MerkleTreeConfig merkleTreeConfig)
Sets theMerkleTreeConfig
for thisCacheSimpleConfig
CacheSimpleConfig
setName(java.lang.String name)
Sets the name of thisICache
.CacheSimpleConfig
setPartitionLostListenerConfigs(java.util.List<CachePartitionLostListenerConfig> partitionLostListenerConfigs)
Sets the PartitionLostListenerConfigs.CacheSimpleConfig
setReadThrough(boolean readThrough)
Enables or disables read-through: a read loads the entry from the data store if it is not already in the cache.CacheSimpleConfig
setSplitBrainProtectionName(java.lang.String splitBrainProtectionName)
Associates this cache configuration to a split brain protection.CacheSimpleConfig
setStatisticsEnabled(boolean statisticsEnabled)
Sets statistics to enabled or disabled for thisICache
.CacheSimpleConfig
setValueType(java.lang.String valueType)
Sets the value type for thisICache
.CacheSimpleConfig
setWanReplicationRef(WanReplicationRef wanReplicationRef)
Sets the WAN target replication reference.CacheSimpleConfig
setWriteThrough(boolean writeThrough)
Enables or disables write-through for thisICache
: a write to the queue also loads the entry into the data store.java.lang.String
toString()
void
writeData(ObjectDataOutput out)
Writes object fields to output stream
-
-
-
Field Detail
-
MIN_BACKUP_COUNT
public static final int MIN_BACKUP_COUNT
The minimum number of backups.- See Also:
- Constant Field Values
-
MAX_BACKUP_COUNT
public static final int MAX_BACKUP_COUNT
The maximum number of backups.- See Also:
- Constant Field Values
-
DEFAULT_BACKUP_COUNT
public static final int DEFAULT_BACKUP_COUNT
The default number of backups.- See Also:
- Constant Field Values
-
DEFAULT_IN_MEMORY_FORMAT
public static final InMemoryFormat DEFAULT_IN_MEMORY_FORMAT
Default InMemory Format.
-
-
Constructor Detail
-
CacheSimpleConfig
public CacheSimpleConfig(CacheSimpleConfig cacheSimpleConfig)
-
CacheSimpleConfig
public CacheSimpleConfig(java.lang.String name)
Create a Cache Simple Config for a cache with a specific name.- Parameters:
name
- cache name
-
CacheSimpleConfig
public CacheSimpleConfig()
-
-
Method Detail
-
getName
public java.lang.String getName()
Gets the name of thisICache
.- Specified by:
getName
in interfaceNamedConfig
- Returns:
- the name of the
ICache
-
setName
public CacheSimpleConfig setName(java.lang.String name)
Sets the name of thisICache
.- Specified by:
setName
in interfaceNamedConfig
- Parameters:
name
- the name to set for thisICache
- Returns:
- the current cache config instance
-
getKeyType
public java.lang.String getKeyType()
Gets the key type for thisICache
.- Returns:
- the key type
-
setKeyType
public CacheSimpleConfig setKeyType(java.lang.String keyType)
Sets the key type for thisICache
.- Parameters:
keyType
- the key type to set for thisICache
- Returns:
- the current cache config instance
-
getValueType
public java.lang.String getValueType()
Gets the value type for thisICache
.- Returns:
- the value type for this
ICache
-
setValueType
public CacheSimpleConfig setValueType(java.lang.String valueType)
Sets the value type for thisICache
.- Parameters:
valueType
- the value type to set for thisICache
- Returns:
- the current cache config instance
-
isStatisticsEnabled
public boolean isStatisticsEnabled()
Checks if statistics are enabled for thisICache
.- Returns:
true
if statistics are enabled,false
otherwise
-
setStatisticsEnabled
public CacheSimpleConfig setStatisticsEnabled(boolean statisticsEnabled)
Sets statistics to enabled or disabled for thisICache
.- Parameters:
statisticsEnabled
-true
to enable cache statistics,false
to disable- Returns:
- the current cache config instance
-
isManagementEnabled
public boolean isManagementEnabled()
Checks if management is enabled for thisICache
.- Returns:
true
if cache management is enabled,false
otherwise
-
setManagementEnabled
public CacheSimpleConfig setManagementEnabled(boolean managementEnabled)
Sets management to enabled or disabled for thisICache
.- Parameters:
managementEnabled
-true
to enable cache management,false
to disable- Returns:
- the current cache config instance
-
isReadThrough
public boolean isReadThrough()
Checks if thisICache
is read-through: a read loads the entry from the data store if it is not already in the cache.- Returns:
true
if the cache is read-through,false
otherwise
-
setReadThrough
public CacheSimpleConfig setReadThrough(boolean readThrough)
Enables or disables read-through: a read loads the entry from the data store if it is not already in the cache.- Parameters:
readThrough
-true
to enable read-through for thisICache
,false
to disable- Returns:
- the current cache config instance
-
isWriteThrough
public boolean isWriteThrough()
Checks if theICache
is write-through: a write to the queue also loads the entry into the data store.- Returns:
true
if the cache is write-through,false
otherwise
-
setWriteThrough
public CacheSimpleConfig setWriteThrough(boolean writeThrough)
Enables or disables write-through for thisICache
: a write to the queue also loads the entry into the data store.- Parameters:
writeThrough
-true
to enable write-through,false
to disable- Returns:
- the current cache config instance
-
getCacheLoaderFactory
public java.lang.String getCacheLoaderFactory()
Gets the factory for theCacheLoader
.- Returns:
- the factory for the
CacheLoader
-
setCacheLoaderFactory
public CacheSimpleConfig setCacheLoaderFactory(java.lang.String cacheLoaderFactory)
Sets the factory for thisCacheLoader
.- Parameters:
cacheLoaderFactory
- the factory to set for thisCacheLoader
- Returns:
- the current cache config instance
-
getCacheLoader
public java.lang.String getCacheLoader()
Get classname of a class to be used asCacheLoader
.- Returns:
- classname to be used as
CacheLoader
-
setCacheLoader
public CacheSimpleConfig setCacheLoader(java.lang.String cacheLoader)
Set classname of a class to be used asCacheLoader
.- Parameters:
cacheLoader
- classname to be used asCacheLoader
- Returns:
- the current cache config instance
-
getCacheWriterFactory
public java.lang.String getCacheWriterFactory()
Gets the factory for theCacheWriter
.- Returns:
- the factory for the
CacheWriter
-
setCacheWriterFactory
public CacheSimpleConfig setCacheWriterFactory(java.lang.String cacheWriterFactory)
Sets the factory for thisCacheWriter
.- Parameters:
cacheWriterFactory
- the factory to set for thisCacheWriter
- Returns:
- the current cache config instance
-
getCacheWriter
public java.lang.String getCacheWriter()
Get classname of a class to be used asCacheWriter
.- Returns:
- classname to be used as
CacheWriter
-
setCacheWriter
public CacheSimpleConfig setCacheWriter(java.lang.String cacheWriter)
Set classname of a class to be used asCacheWriter
.- Parameters:
cacheWriter
- classname to be used asCacheWriter
- Returns:
- the current cache config instance
-
getExpiryPolicyFactoryConfig
public CacheSimpleConfig.ExpiryPolicyFactoryConfig getExpiryPolicyFactoryConfig()
Gets the factory configuration for theExpiryPolicy
.- Returns:
- the factory configuration for the
ExpiryPolicy
-
setExpiryPolicyFactoryConfig
public CacheSimpleConfig setExpiryPolicyFactoryConfig(CacheSimpleConfig.ExpiryPolicyFactoryConfig expiryPolicyFactoryConfig)
Sets the factory configuration for thisExpiryPolicy
.- Parameters:
expiryPolicyFactoryConfig
- the factory configuration to set for thisExpiryPolicy
- Returns:
- the current cache config instance
-
setExpiryPolicyFactory
public CacheSimpleConfig setExpiryPolicyFactory(java.lang.String className)
Sets the factory for thisExpiryPolicy
.- Parameters:
className
- the factory to set for thisExpiryPolicy
- Returns:
- the current cache config instance
-
addEntryListenerConfig
public CacheSimpleConfig addEntryListenerConfig(CacheSimpleEntryListenerConfig listenerConfig)
AddsCacheSimpleEntryListenerConfig
to thisICache
.- Returns:
- this
CacheSimpleConfig
instance
-
getCacheEntryListeners
public java.util.List<CacheSimpleEntryListenerConfig> getCacheEntryListeners()
Gets a list ofCacheSimpleEntryListenerConfig
from thisICache
.- Returns:
- list of
CacheSimpleEntryListenerConfig
-
setCacheEntryListeners
public CacheSimpleConfig setCacheEntryListeners(java.util.List<CacheSimpleEntryListenerConfig> cacheEntryListeners)
Sets a list ofCacheSimpleEntryListenerConfig
for thisICache
.- Parameters:
cacheEntryListeners
- list ofCacheSimpleEntryListenerConfig
- Returns:
- this
CacheSimpleConfig
instance
-
getAsyncBackupCount
public int getAsyncBackupCount()
Gets the number of asynchronous backups for thisICache
.- Returns:
- the number of asynchronous backups for this
ICache
-
setAsyncBackupCount
public CacheSimpleConfig setAsyncBackupCount(int asyncBackupCount)
Sets the number of asynchronous backups for thisICache
.- Parameters:
asyncBackupCount
- the number of asynchronous synchronous backups to set- Returns:
- the updated CacheSimpleConfig
- Throws:
java.lang.IllegalArgumentException
- if asyncBackupCount smaller than 0, or larger than the maximum number of backups, or the sum of the backups and async backups is larger than the maximum number of backups- See Also:
setBackupCount(int)
,getAsyncBackupCount()
-
getBackupCount
public int getBackupCount()
Gets the number of synchronous backups for thisICache
.- Returns:
- the number of synchronous backups
-
setBackupCount
public CacheSimpleConfig setBackupCount(int backupCount)
Sets the number of synchronous backups for thisICache
.- Parameters:
backupCount
- the new backupCount- Returns:
- the updated CacheSimpleConfig
- Throws:
java.lang.IllegalArgumentException
- if backupCount smaller than 0, or larger than the maximum number of backup or the sum of the backups and async backups is larger than the maximum number of backups
-
getInMemoryFormat
public InMemoryFormat getInMemoryFormat()
Gets the InMemory Format for thisICache
.- Returns:
- the InMemory Format
-
setInMemoryFormat
public CacheSimpleConfig setInMemoryFormat(InMemoryFormat inMemoryFormat)
Sets the InMemory Format for thisICache
.- Parameters:
inMemoryFormat
- the InMemory Format- Returns:
- the updated CacheSimpleConfig
-
getEvictionConfig
public EvictionConfig getEvictionConfig()
Gets the eviction configuration for thisICache
.- Returns:
- the eviction configuration
-
setEvictionConfig
public CacheSimpleConfig setEvictionConfig(EvictionConfig evictionConfig)
Sets the eviction configuration for thisICache
.- Parameters:
evictionConfig
- the eviction configuration to set- Returns:
- the updated CacheSimpleConfig
-
getWanReplicationRef
public WanReplicationRef getWanReplicationRef()
Gets the WAN target replication reference.- Returns:
- the WAN target replication reference
-
setWanReplicationRef
public CacheSimpleConfig setWanReplicationRef(WanReplicationRef wanReplicationRef)
Sets the WAN target replication reference.- Parameters:
wanReplicationRef
- the WAN target replication reference- Returns:
- this configuration
-
getPartitionLostListenerConfigs
public java.util.List<CachePartitionLostListenerConfig> getPartitionLostListenerConfigs()
Gets the partition lost listener references added to cache configuration.- Returns:
- List of CachePartitionLostListenerConfig
-
setPartitionLostListenerConfigs
public CacheSimpleConfig setPartitionLostListenerConfigs(java.util.List<CachePartitionLostListenerConfig> partitionLostListenerConfigs)
Sets the PartitionLostListenerConfigs.- Parameters:
partitionLostListenerConfigs
- CachePartitionLostListenerConfig list
-
addCachePartitionLostListenerConfig
public CacheSimpleConfig addCachePartitionLostListenerConfig(CachePartitionLostListenerConfig listenerConfig)
Adds the CachePartitionLostListenerConfig to partitionLostListenerConfigs.- Parameters:
listenerConfig
- CachePartitionLostListenerConfig to be added
-
getSplitBrainProtectionName
public java.lang.String getSplitBrainProtectionName()
Gets the name of the associated split brain protection if any.- Returns:
- the name of the associated split brain protection if any
-
setSplitBrainProtectionName
public CacheSimpleConfig setSplitBrainProtectionName(java.lang.String splitBrainProtectionName)
Associates this cache configuration to a split brain protection.- Parameters:
splitBrainProtectionName
- name of the desired split brain protection- Returns:
- the updated CacheSimpleConfig
-
getMergePolicyConfig
public MergePolicyConfig getMergePolicyConfig()
Gets theMergePolicyConfig
for this map.- Returns:
- the
MergePolicyConfig
for this map
-
setMergePolicyConfig
public CacheSimpleConfig setMergePolicyConfig(MergePolicyConfig mergePolicyConfig)
Sets theMergePolicyConfig
for this map.- Returns:
- the updated map configuration
-
getHotRestartConfig
public HotRestartConfig getHotRestartConfig()
Gets theHotRestartConfig
for thisCacheSimpleConfig
- Returns:
- hot restart config
-
getDataPersistenceConfig
public DataPersistenceConfig getDataPersistenceConfig()
Gets theDataPersistenceConfig
for thisCacheSimpleConfig
- Returns:
- dataPersistenceConfig config
-
setHotRestartConfig
@Deprecated public CacheSimpleConfig setHotRestartConfig(HotRestartConfig hotRestartConfig)
Deprecated.since 5.0 usesetDataPersistenceConfig(DataPersistenceConfig)
Sets theHotRestartConfig
for thisCacheSimpleConfig
- Parameters:
hotRestartConfig
- hot restart config- Returns:
- this
CacheSimpleConfig
instance
-
setDataPersistenceConfig
public CacheSimpleConfig setDataPersistenceConfig(DataPersistenceConfig dataPersistenceConfig)
Sets theDataPersistenceConfig
for thisCacheSimpleConfig
- Parameters:
dataPersistenceConfig
- dataPersistenceConfig config- Returns:
- this
CacheSimpleConfig
instance
-
getEventJournalConfig
public EventJournalConfig getEventJournalConfig()
Gets theEventJournalConfig
for thisCacheSimpleConfig
- Returns:
- event journal config
-
setEventJournalConfig
public CacheSimpleConfig setEventJournalConfig(@Nonnull EventJournalConfig eventJournalConfig)
Sets theEventJournalConfig
for thisCacheSimpleConfig
- Parameters:
eventJournalConfig
- event journal config- Returns:
- this
CacheSimpleConfig
instance
-
isDisablePerEntryInvalidationEvents
public boolean isDisablePerEntryInvalidationEvents()
Returns invalidation events disabled status for per entry.- Returns:
true
if invalidation events are disabled for per entry,false
otherwise
-
setDisablePerEntryInvalidationEvents
public CacheSimpleConfig setDisablePerEntryInvalidationEvents(boolean disablePerEntryInvalidationEvents)
Sets invalidation events disabled status for per entry.- Parameters:
disablePerEntryInvalidationEvents
- Disables invalidation event sending behaviour if it istrue
, otherwise enables it- Returns:
- this configuration
-
getMerkleTreeConfig
@Nonnull public MerkleTreeConfig getMerkleTreeConfig()
Gets theMerkleTreeConfig
for thisCacheSimpleConfig
- Returns:
- merkle tree config
-
setMerkleTreeConfig
public CacheSimpleConfig setMerkleTreeConfig(@Nonnull MerkleTreeConfig merkleTreeConfig)
Sets theMerkleTreeConfig
for thisCacheSimpleConfig
- Parameters:
merkleTreeConfig
- merkle tree config- Returns:
- this
CacheSimpleConfig
instance
-
getFactoryId
public int getFactoryId()
Description copied from interface:IdentifiedDataSerializable
Returns DataSerializableFactory factory ID for this class.- Specified by:
getFactoryId
in interfaceIdentifiedDataSerializable
- Returns:
- factory ID
-
getClassId
public int getClassId()
Description copied from interface:IdentifiedDataSerializable
Returns type identifier for this class. It should be unique per DataSerializableFactory.- Specified by:
getClassId
in interfaceIdentifiedDataSerializable
- Returns:
- type ID
-
writeData
public void writeData(ObjectDataOutput out) throws java.io.IOException
Description copied from interface:DataSerializable
Writes object fields to output stream- Specified by:
writeData
in interfaceDataSerializable
- Parameters:
out
- output- Throws:
java.io.IOException
- if an I/O error occurs. In particular, anIOException
may be thrown if the output stream has been closed.
-
readData
public void readData(ObjectDataInput in) throws java.io.IOException
Description copied from interface:DataSerializable
Reads fields from the input stream- Specified by:
readData
in interfaceDataSerializable
- Parameters:
in
- input- Throws:
java.io.IOException
- if an I/O error occurs. In particular, anIOException
may be thrown if the input stream has been closed.
-
equals
public final boolean equals(java.lang.Object o)
- Overrides:
equals
in classjava.lang.Object
-
hashCode
public final int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-