Package com.hazelcast.config
Class EvictionConfig
java.lang.Object
com.hazelcast.config.EvictionConfig
- All Implemented Interfaces:
- com.hazelcast.internal.eviction.EvictionConfiguration,- DataSerializable,- IdentifiedDataSerializable,- Serializable
public class EvictionConfig
extends Object
implements com.hazelcast.internal.eviction.EvictionConfiguration, IdentifiedDataSerializable, Serializable
Configuration for eviction.
 
You can set a limit for number of entries or total memory cost of entries.
The default values of the eviction configuration are:
- EvictionPolicy.LRUas eviction policy
- MaxSizePolicy.ENTRY_COUNTas max size policy
- 2147483647 as maximum
 size for on-heap IMap
- 10000 as maximum size for all other data structures and configurations
- See Also:
- 
Field SummaryFieldsModifier and TypeFieldDescriptionprotected EvictionPolicyComparatorprotected Stringstatic final EvictionPolicyDefault Eviction Policy.static final intDefault maximum entry count.static final MaxSizePolicyDefault Max-Size Policy.protected EvictionPolicyprotected MaxSizePolicyprotected int
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionfinal booleanintReturns type identifier for this class.Returns the instance of the configuredEvictionPolicyComparatorimplementation.Returns the class name of the configuredEvictionPolicyComparatorimplementation.Returns theEvictionPolicyof this eviction configuration.com.hazelcast.internal.eviction.EvictionStrategyTypeReturns theEvictionStrategyTypeof this eviction configuration.intReturns DataSerializableFactory factory ID for this class.Returns theMaxSizePolicyof this eviction configuration.intgetSize()Returns the size which is used by theMaxSizePolicy.final inthashCode()voidReads fields from the input streamsetComparator(EvictionPolicyComparator comparator) Sets the instance of the configuredEvictionPolicyComparatorimplementation.setComparatorClassName(String comparatorClassName) Sets the class name of the configuredEvictionPolicyComparatorimplementation.setEvictionPolicy(EvictionPolicy evictionPolicy) Sets theEvictionPolicyof this eviction configuration.setMaxSizePolicy(MaxSizePolicy maxSizePolicy) Sets theMaxSizePolicyof this eviction configuration.setSize(int size) Sets the size which is used by theMaxSizePolicy.toString()voidWrites object fields to output stream
- 
Field Details- 
DEFAULT_MAX_ENTRY_COUNTpublic static final int DEFAULT_MAX_ENTRY_COUNTDefault maximum entry count.- See Also:
 
- 
DEFAULT_MAX_SIZE_POLICYDefault Max-Size Policy.
- 
DEFAULT_EVICTION_POLICYDefault Eviction Policy.
- 
sizeprotected int size
- 
maxSizePolicy
- 
evictionPolicy
- 
comparatorClassName
- 
comparator
 
- 
- 
Constructor Details- 
EvictionConfigpublic EvictionConfig()
- 
EvictionConfig
 
- 
- 
Method Details- 
getSizepublic int getSize()Returns the size which is used by theMaxSizePolicy.The interpretation of the value depends on the configured MaxSizePolicy.- Returns:
- the size which is used by the MaxSizePolicy
 
- 
setSizeSets the size which is used by theMaxSizePolicy.The interpretation of the value depends on the configured MaxSizePolicy.Accepts any non-negative number. The default value is 10000. - Parameters:
- size- the size which is used by the- MaxSizePolicy
- Returns:
- this EvictionConfig instance
 
- 
getMaxSizePolicyReturns theMaxSizePolicyof this eviction configuration.- Returns:
- the MaxSizePolicyof this eviction configuration
 
- 
setMaxSizePolicySets theMaxSizePolicyof this eviction configuration.- Parameters:
- maxSizePolicy- the- MaxSizePolicyof this eviction configuration
- Returns:
- this EvictionConfig instance
 
- 
getEvictionPolicyReturns theEvictionPolicyof this eviction configuration.- Specified by:
- getEvictionPolicyin interface- com.hazelcast.internal.eviction.EvictionConfiguration
- Returns:
- the EvictionPolicyof this eviction configuration
 
- 
setEvictionPolicySets theEvictionPolicyof this eviction configuration.- Parameters:
- evictionPolicy- the- EvictionPolicyof this eviction configuration
- Returns:
- this EvictionConfig instance
 
- 
getEvictionStrategyTypepublic com.hazelcast.internal.eviction.EvictionStrategyType getEvictionStrategyType()Returns theEvictionStrategyTypeof this eviction configuration.- Specified by:
- getEvictionStrategyTypein interface- com.hazelcast.internal.eviction.EvictionConfiguration
- Returns:
- the EvictionStrategyTypeof this eviction configuration
 
- 
getComparatorClassNameReturns the class name of the configuredEvictionPolicyComparatorimplementation.- Specified by:
- getComparatorClassNamein interface- com.hazelcast.internal.eviction.EvictionConfiguration
- Returns:
- the class name of the configured
 EvictionPolicyComparatorimplementation
 
- 
setComparatorClassNameSets the class name of the configuredEvictionPolicyComparatorimplementation.Only one of the comparator class nameandcomparatorcan be configured in the eviction configuration.- Parameters:
- comparatorClassName- the class name of the configured- EvictionPolicyComparatorimplementation
- Returns:
- this EvictionConfig instance
 
- 
getComparatorReturns the instance of the configuredEvictionPolicyComparatorimplementation.- Specified by:
- getComparatorin interface- com.hazelcast.internal.eviction.EvictionConfiguration
- Returns:
- the instance of the configured EvictionPolicyComparatorimplementation
 
- 
setComparatorSets the instance of the configuredEvictionPolicyComparatorimplementation.Only one of the comparator class nameandcomparatorcan be configured in the eviction configuration.- Parameters:
- comparator- the instance of the configured- EvictionPolicyComparatorimplementation
- Returns:
- this EvictionConfig instance
- See Also:
 
- 
getFactoryIdpublic int getFactoryId()Description copied from interface:IdentifiedDataSerializableReturns DataSerializableFactory factory ID for this class.- Specified by:
- getFactoryIdin interface- IdentifiedDataSerializable
- Returns:
- factory ID
 
- 
getClassIdpublic int getClassId()Description copied from interface:IdentifiedDataSerializableReturns type identifier for this class. It should be unique per DataSerializableFactory.- Specified by:
- getClassIdin interface- IdentifiedDataSerializable
- Returns:
- type ID
 
- 
writeDataDescription copied from interface:DataSerializableWrites object fields to output stream- Specified by:
- writeDatain interface- DataSerializable
- Parameters:
- out- output
- Throws:
- IOException- if an I/O error occurs. In particular, an- IOExceptionmay be thrown if the output stream has been closed.
 
- 
readDataDescription copied from interface:DataSerializableReads fields from the input stream- Specified by:
- readDatain interface- DataSerializable
- Parameters:
- in- input
- Throws:
- IOException- if an I/O error occurs. In particular, an- IOExceptionmay be thrown if the input stream has been closed.
 
- 
toString
- 
equals
- 
hashCodepublic final int hashCode()
 
-