com.hazelcast.config

## Class CacheSimpleConfig

- java.lang.Object
- - com.hazelcast.config.CacheSimpleConfig

- All Implemented Interfaces:
    NamedConfig, DataSerializable, IdentifiedDataSerializable, SplitBrainMergeTypeProvider
  Direct Known Subclasses:
    CacheSimpleConfigReadOnly

      public class CacheSimpleConfig
      extends Object
      implements SplitBrainMergeTypeProvider, IdentifiedDataSerializable, NamedConfig

  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 and Description
    --- | ---
    `static class` | `CacheSimpleConfig.ExpiryPolicyFactoryConfig` Represents configuration for "ExpiryPolicyFactory".

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static int` | `DEFAULT_BACKUP_COUNT` The default number of backups.
    `static String` | `DEFAULT_CACHE_MERGE_POLICY` Default policy for merging
    `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 and Description
    `CacheSimpleConfig()`
    `CacheSimpleConfig(CacheSimpleConfig cacheSimpleConfig)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods Deprecated Methods
    Modifier and Type | Method and Description
    --- | ---
    `CacheSimpleConfig` | `addCachePartitionLostListenerConfig(CachePartitionLostListenerConfig listenerConfig)` Adds the CachePartitionLostListenerConfig to partitionLostListenerConfigs.
    `CacheSimpleConfig` | `addEntryListenerConfig(CacheSimpleEntryListenerConfig listenerConfig)` Adds `CacheSimpleEntryListenerConfig` to this `ICache`.
    `boolean` | `equals(Object o)`
    `CacheSimpleConfig` | `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`.
    `List<CacheSimpleEntryListenerConfig>` | `getCacheEntryListeners()` Gets a list of `CacheSimpleEntryListenerConfig` from this `ICache`.
    `String` | `getCacheLoader()` Get classname of a class to be used as `CacheLoader`.
    `String` | `getCacheLoaderFactory()` Gets the factory for the `CacheLoader`.
    `String` | `getCacheWriter()` Get classname of a class to be used as `CacheWriter`.
    `String` | `getCacheWriterFactory()` Gets the factory for the `CacheWriter`.
    `EvictionConfig` | `getEvictionConfig()` Gets the eviction configuration for this `ICache`.
    `CacheSimpleConfig.ExpiryPolicyFactoryConfig` | `getExpiryPolicyFactoryConfig()` Gets the factory configuration for the `ExpiryPolicy`.
    `int` | `getFactoryId()` Returns DataSerializableFactory factory ID for this class.
    `HotRestartConfig` | `getHotRestartConfig()` Gets the `HotRestartConfig` for this `CacheSimpleConfig`
    `int` | `getId()` Returns type identifier for this class.
    `InMemoryFormat` | `getInMemoryFormat()` Gets the InMemory Format for this `ICache`.
    `String` | `getKeyType()` Gets the key type for this `ICache`.
    `String` | `getMergePolicy()` Gets the class name of `CacheMergePolicy` implementation of this cache config.
    `String` | `getName()` Gets the name of this `ICache`.
    `List<CachePartitionLostListenerConfig>` | `getPartitionLostListenerConfigs()` Gets the partition lost listener references added to cache configuration.
    `Class` | `getProvidedMergeTypes()`
    `String` | `getQuorumName()` Gets the name of the associated quorum if any.
    `String` | `getValueType()` Gets the value type for this `ICache`.
    `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 this `ICache`.
    `boolean` | `isReadThrough()` Checks if this `ICache` 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 this `ICache`.
    `boolean` | `isWriteThrough()` Checks if the `ICache` 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 stream
    `CacheSimpleConfig` | `setAsyncBackupCount(int asyncBackupCount)` Sets the number of asynchronous backups for this `ICache`.
    `CacheSimpleConfig` | `setBackupCount(int backupCount)` Sets the number of synchronous backups for this `ICache`.
    `CacheSimpleConfig` | `setCacheEntryListeners(List<CacheSimpleEntryListenerConfig> cacheEntryListeners)` Sets a list of `CacheSimpleEntryListenerConfig` for this `ICache`.
    `CacheSimpleConfig` | `setCacheLoader(String cacheLoader)` Set classname of a class to be used as `CacheLoader`.
    `CacheSimpleConfig` | `setCacheLoaderFactory(String cacheLoaderFactory)` Sets the factory for this `CacheLoader`.
    `CacheSimpleConfig` | `setCacheWriter(String cacheWriter)` Set classname of a class to be used as `CacheWriter`.
    `CacheSimpleConfig` | `setCacheWriterFactory(String cacheWriterFactory)` Sets the factory for this `CacheWriter`.
    `void` | `setDisablePerEntryInvalidationEvents(boolean disablePerEntryInvalidationEvents)` Sets invalidation events disabled status for per entry.
    `CacheSimpleConfig` | `setEvictionConfig(EvictionConfig evictionConfig)` Sets the eviction configuration for this `ICache`.
    `CacheSimpleConfig` | `setExpiryPolicyFactory(String className)` Sets the factory for this `ExpiryPolicy`.
    `CacheSimpleConfig` | `setExpiryPolicyFactoryConfig(CacheSimpleConfig.ExpiryPolicyFactoryConfig expiryPolicyFactoryConfig)` Sets the factory configuration for this `ExpiryPolicy`.
    `CacheSimpleConfig` | `setHotRestartConfig(HotRestartConfig hotRestartConfig)` Sets the `HotRestartConfig` for this `CacheSimpleConfig`
    `CacheSimpleConfig` | `setInMemoryFormat(InMemoryFormat inMemoryFormat)` Sets the InMemory Format for this `ICache`.
    `CacheSimpleConfig` | `setKeyType(String keyType)` Sets the key type for this `ICache`.
    `CacheSimpleConfig` | `setManagementEnabled(boolean managementEnabled)` Sets management to enabled or disabled for this `ICache`.
    `void` | `setMergePolicy(String mergePolicy)` Sets the class name of `CacheMergePolicy` implementation to this cache config.
    `CacheSimpleConfig` | `setName(String name)` Sets the name of this `ICache`.
    `CacheSimpleConfig` | `setPartitionLostListenerConfigs(List<CachePartitionLostListenerConfig> partitionLostListenerConfigs)` Sets the PartitionLostListenerConfigs.
    `CacheSimpleConfig` | `setQuorumName(String quorumName)` Associates this cache configuration to a quorum.
    `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` | `setStatisticsEnabled(boolean statisticsEnabled)` Sets statistics to enabled or disabled for this `ICache`.
    `CacheSimpleConfig` | `setValueType(String valueType)` Sets the value type for this `ICache`.
    `void` | `setWanReplicationRef(WanReplicationRef wanReplicationRef)` Sets the WAN target replication reference.
    `CacheSimpleConfig` | `setWriteThrough(boolean writeThrough)` Enables or disables write-through for this `ICache`: a write to the queue also loads the entry into the data store.
    `String` | `toString()`
    `void` | `writeData(ObjectDataOutput out)` Writes object fields to output stream

    - ### Methods inherited from class java.lang.Object

      `clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

- - ### 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.

    - #### DEFAULT_CACHE_MERGE_POLICY

          public static final String DEFAULT_CACHE_MERGE_POLICY

      Default policy for merging

  - ### Constructor Detail

    - #### CacheSimpleConfig

          public CacheSimpleConfig(CacheSimpleConfig cacheSimpleConfig)

    - #### CacheSimpleConfig

          public CacheSimpleConfig()

  - ### Method Detail

    - #### getAsReadOnly

          public CacheSimpleConfig getAsReadOnly()

      Deprecated. this method will be removed in 4.0; it is meant for internal usage only
      Gets immutable version of this configuration.
      Returns:
        immutable version of this configuration

    - #### getName

          public String getName()

      Gets the name of this `ICache`.
      Specified by:
        `getName` in interface `NamedConfig`
      Returns:
        the name of the `ICache`

    - #### setName

          public CacheSimpleConfig setName(String name)

      Sets the name of this `ICache`.
      Specified by:
        `setName` in interface `NamedConfig`
      Parameters:
        `name` - the name to set for this `ICache`
      Returns:
        the current cache config instance

    - #### getKeyType

          public String getKeyType()

      Gets the key type for this `ICache`.
      Returns:
        the key type

    - #### setKeyType

          public CacheSimpleConfig setKeyType(String keyType)

      Sets the key type for this `ICache`.
      Parameters:
        `keyType` - the key type to set for this `ICache`
      Returns:
        the current cache config instance

    - #### getValueType

          public String getValueType()

      Gets the value type for this `ICache`.
      Returns:
        the value type for this `ICache`

    - #### setValueType

          public CacheSimpleConfig setValueType(String valueType)

      Sets the value type for this `ICache`.
      Parameters:
        `valueType` - the value type to set for this `ICache`
      Returns:
        the current cache config instance

    - #### isStatisticsEnabled

          public boolean isStatisticsEnabled()

      Checks if statistics are enabled for this `ICache`.
      Returns:
        `true` if statistics are enabled, `false` otherwise

    - #### setStatisticsEnabled

          public CacheSimpleConfig setStatisticsEnabled(boolean statisticsEnabled)

      Sets statistics to enabled or disabled for this `ICache`.
      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 this `ICache`.
      Returns:
        `true` if cache management is enabled, `false` otherwise

    - #### setManagementEnabled

          public CacheSimpleConfig setManagementEnabled(boolean managementEnabled)

      Sets management to enabled or disabled for this `ICache`.
      Parameters:
        `managementEnabled` - `true` to enable cache management, `false` to disable
      Returns:
        the current cache config instance

    - #### isReadThrough

          public boolean isReadThrough()

      Checks if this `ICache` 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 this `ICache`, `false` to disable
      Returns:
        the current cache config instance

    - #### isWriteThrough

          public boolean isWriteThrough()

      Checks if the `ICache` 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 this `ICache`: 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 String getCacheLoaderFactory()

      Gets the factory for the `CacheLoader`.
      Returns:
        the factory for the `CacheLoader`

    - #### setCacheLoaderFactory

          public CacheSimpleConfig setCacheLoaderFactory(String cacheLoaderFactory)

      Sets the factory for this `CacheLoader`.
      Parameters:
        `cacheLoaderFactory` - the factory to set for this `CacheLoader`
      Returns:
        the current cache config instance

    - #### getCacheLoader

          public String getCacheLoader()

      Get classname of a class to be used as `CacheLoader`.
      Returns:
        classname to be used as `CacheLoader`

    - #### setCacheLoader

          public CacheSimpleConfig setCacheLoader(String cacheLoader)

      Set classname of a class to be used as `CacheLoader`.
      Parameters:
        `cacheLoader` - classname to be used as `CacheLoader`
      Returns:
        the current cache config instance

    - #### getCacheWriterFactory

          public String getCacheWriterFactory()

      Gets the factory for the `CacheWriter`.
      Returns:
        the factory for the `CacheWriter`

    - #### setCacheWriterFactory

          public CacheSimpleConfig setCacheWriterFactory(String cacheWriterFactory)

      Sets the factory for this `CacheWriter`.
      Parameters:
        `cacheWriterFactory` - the factory to set for this `CacheWriter`
      Returns:
        the current cache config instance

    - #### getCacheWriter

          public String getCacheWriter()

      Get classname of a class to be used as `CacheWriter`.
      Returns:
        classname to be used as `CacheWriter`

    - #### setCacheWriter

          public CacheSimpleConfig setCacheWriter(String cacheWriter)

      Set classname of a class to be used as `CacheWriter`.
      Parameters:
        `cacheWriter` - classname to be used as `CacheWriter`
      Returns:
        the current cache config instance

    - #### getExpiryPolicyFactoryConfig

          public CacheSimpleConfig.ExpiryPolicyFactoryConfig getExpiryPolicyFactoryConfig()

      Gets the factory configuration for the `ExpiryPolicy`.
      Returns:
        the factory configuration for the `ExpiryPolicy`

    - #### setExpiryPolicyFactoryConfig

          public CacheSimpleConfig setExpiryPolicyFactoryConfig(CacheSimpleConfig.ExpiryPolicyFactoryConfig expiryPolicyFactoryConfig)

      Sets the factory configuration for this `ExpiryPolicy`.
      Parameters:
        `expiryPolicyFactoryConfig` - the factory configuration to set for this `ExpiryPolicy`
      Returns:
        the current cache config instance

    - #### setExpiryPolicyFactory

          public CacheSimpleConfig setExpiryPolicyFactory(String className)

      Sets the factory for this `ExpiryPolicy`.
      Parameters:
        `className` - the factory to set for this `ExpiryPolicy`
      Returns:
        the current cache config instance

    - #### addEntryListenerConfig

          public CacheSimpleConfig addEntryListenerConfig(CacheSimpleEntryListenerConfig listenerConfig)

      Adds `CacheSimpleEntryListenerConfig` to this `ICache`.
      Returns:
        this `CacheSimpleConfig` instance

    - #### getCacheEntryListeners

          public List<CacheSimpleEntryListenerConfig> getCacheEntryListeners()

      Gets a list of `CacheSimpleEntryListenerConfig` from this `ICache`.
      Returns:
        list of `CacheSimpleEntryListenerConfig`

    - #### setCacheEntryListeners

          public CacheSimpleConfig setCacheEntryListeners(List<CacheSimpleEntryListenerConfig> cacheEntryListeners)

      Sets a list of `CacheSimpleEntryListenerConfig` for this `ICache`.
      Parameters:
        `cacheEntryListeners` - list of `CacheSimpleEntryListenerConfig`
      Returns:
        this `CacheSimpleConfig` instance

    - #### getAsyncBackupCount

          public int getAsyncBackupCount()

      Gets the number of asynchronous backups for this `ICache`.
      Returns:
        the number of asynchronous backups for this `ICache`

    - #### setAsyncBackupCount

          public CacheSimpleConfig setAsyncBackupCount(int asyncBackupCount)

      Sets the number of asynchronous backups for this `ICache`.
      Parameters:
        `asyncBackupCount` - the number of asynchronous synchronous backups to set
      Returns:
        the updated CacheSimpleConfig
      Throws:
        `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 this `ICache`.
      Returns:
        the number of synchronous backups

    - #### setBackupCount

          public CacheSimpleConfig setBackupCount(int backupCount)

      Sets the number of synchronous backups for this `ICache`.
      Parameters:
        `backupCount` - the new backupCount
      Returns:
        the updated CacheSimpleConfig
      Throws:
        `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 this `ICache`.
      Returns:
        the InMemory Format

    - #### setInMemoryFormat

          public CacheSimpleConfig setInMemoryFormat(InMemoryFormat inMemoryFormat)

      Sets the InMemory Format for this `ICache`.
      Parameters:
        `inMemoryFormat` - the InMemory Format
      Returns:
        the updated CacheSimpleConfig

    - #### getEvictionConfig

          public EvictionConfig getEvictionConfig()

      Gets the eviction configuration for this `ICache`.
      Returns:
        the eviction configuration

    - #### setEvictionConfig

          public CacheSimpleConfig setEvictionConfig(EvictionConfig evictionConfig)

      Sets the eviction configuration for this `ICache`.
      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 void setWanReplicationRef(WanReplicationRef wanReplicationRef)

      Sets the WAN target replication reference.
      Parameters:
        `wanReplicationRef` - the WAN target replication reference

    - #### getPartitionLostListenerConfigs

          public List<CachePartitionLostListenerConfig> getPartitionLostListenerConfigs()

      Gets the partition lost listener references added to cache configuration.
      Returns:
        List of CachePartitionLostListenerConfig

    - #### setPartitionLostListenerConfigs

          public CacheSimpleConfig setPartitionLostListenerConfigs(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

    - #### getQuorumName

          public String getQuorumName()

      Gets the name of the associated quorum if any.
      Returns:
        the name of the associated quorum if any

    - #### setQuorumName

          public CacheSimpleConfig setQuorumName(String quorumName)

      Associates this cache configuration to a quorum.
      Parameters:
        `quorumName` - name of the desired quorum
      Returns:
        the updated CacheSimpleConfig

    - #### getMergePolicy

          public String getMergePolicy()

      Gets the class name of `CacheMergePolicy` implementation of this cache config.
      Returns:
        the class name of `CacheMergePolicy` implementation of this cache config

    - #### setMergePolicy

          public void setMergePolicy(String mergePolicy)

      Sets the class name of `CacheMergePolicy` implementation to this cache config.
      Parameters:
        `mergePolicy` - the class name of `CacheMergePolicy` implementation to be set to this cache config

    - #### getProvidedMergeTypes

          public Class getProvidedMergeTypes()

      Specified by:
        `getProvidedMergeTypes` in interface `SplitBrainMergeTypeProvider`

    - #### getHotRestartConfig

          public HotRestartConfig getHotRestartConfig()

      Gets the `HotRestartConfig` for this `CacheSimpleConfig`
      Returns:
        hot restart config

    - #### setHotRestartConfig

          public CacheSimpleConfig setHotRestartConfig(HotRestartConfig hotRestartConfig)

      Sets the `HotRestartConfig` for this `CacheSimpleConfig`
      Parameters:
        `hotRestartConfig` - hot restart 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 void setDisablePerEntryInvalidationEvents(boolean disablePerEntryInvalidationEvents)

      Sets invalidation events disabled status for per entry.
      Parameters:
        `disablePerEntryInvalidationEvents` - Disables invalidation event sending behaviour if it is `true`, otherwise enables it

    - #### getFactoryId

          public int getFactoryId()

      Description copied from interface: `IdentifiedDataSerializable`
      Returns DataSerializableFactory factory ID for this class.
      Specified by:
        `getFactoryId` in interface `IdentifiedDataSerializable`
      Returns:
        factory ID

    - #### getId

          public int getId()

      Description copied from interface: `IdentifiedDataSerializable`
      Returns type identifier for this class. It should be unique per DataSerializableFactory.
      Specified by:
        `getId` in interface `IdentifiedDataSerializable`
      Returns:
        type ID

    - #### writeData

          public void writeData(ObjectDataOutput out)
                         throws IOException

      Description copied from interface: `DataSerializable`
      Writes object fields to output stream
      Specified by:
        `writeData` in interface `DataSerializable`
      Parameters:
        `out` - output
      Throws:
        `IOException` - if an I/O error occurs. In particular, an `IOException` may be thrown if the output stream has been closed.

    - #### readData

          public void readData(ObjectDataInput in)
                        throws IOException

      Description copied from interface: `DataSerializable`
      Reads fields from the input stream
      Specified by:
        `readData` in interface `DataSerializable`
      Parameters:
        `in` - input
      Throws:
        `IOException` - if an I/O error occurs. In particular, an `IOException` may be thrown if the input stream has been closed.

    - #### equals

          public final boolean equals(Object o)

      Overrides:
        `equals` in class `Object`

    - #### hashCode

          public final int hashCode()

      Overrides:
        `hashCode` in class `Object`

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`

Copyright © 2019. All rights reserved.