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 policyMaxSizePolicy.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 Summary
FieldsModifier 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 Summary
Constructors -
Method Summary
Modifier 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_COUNT
public static final int DEFAULT_MAX_ENTRY_COUNTDefault maximum entry count.- See Also:
-
DEFAULT_MAX_SIZE_POLICY
Default Max-Size Policy. -
DEFAULT_EVICTION_POLICY
Default Eviction Policy. -
size
protected int size -
maxSizePolicy
-
evictionPolicy
-
comparatorClassName
-
comparator
-
-
Constructor Details
-
EvictionConfig
public EvictionConfig() -
EvictionConfig
-
-
Method Details
-
getSize
public 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
-
setSize
Sets 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 theMaxSizePolicy- Returns:
- this EvictionConfig instance
-
getMaxSizePolicy
Returns theMaxSizePolicyof this eviction configuration.- Returns:
- the
MaxSizePolicyof this eviction configuration
-
setMaxSizePolicy
Sets theMaxSizePolicyof this eviction configuration.- Parameters:
maxSizePolicy- theMaxSizePolicyof this eviction configuration- Returns:
- this EvictionConfig instance
-
getEvictionPolicy
Returns theEvictionPolicyof this eviction configuration.- Specified by:
getEvictionPolicyin interfacecom.hazelcast.internal.eviction.EvictionConfiguration- Returns:
- the
EvictionPolicyof this eviction configuration
-
setEvictionPolicy
Sets theEvictionPolicyof this eviction configuration.- Parameters:
evictionPolicy- theEvictionPolicyof this eviction configuration- Returns:
- this EvictionConfig instance
-
getEvictionStrategyType
public com.hazelcast.internal.eviction.EvictionStrategyType getEvictionStrategyType()Returns theEvictionStrategyTypeof this eviction configuration.- Specified by:
getEvictionStrategyTypein interfacecom.hazelcast.internal.eviction.EvictionConfiguration- Returns:
- the
EvictionStrategyTypeof this eviction configuration
-
getComparatorClassName
Returns the class name of the configuredEvictionPolicyComparatorimplementation.- Specified by:
getComparatorClassNamein interfacecom.hazelcast.internal.eviction.EvictionConfiguration- Returns:
- the class name of the configured
EvictionPolicyComparatorimplementation
-
setComparatorClassName
Sets 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 configuredEvictionPolicyComparatorimplementation- Returns:
- this EvictionConfig instance
-
getComparator
Returns the instance of the configuredEvictionPolicyComparatorimplementation.- Specified by:
getComparatorin interfacecom.hazelcast.internal.eviction.EvictionConfiguration- Returns:
- the instance of the configured
EvictionPolicyComparatorimplementation
-
setComparator
Sets the instance of the configuredEvictionPolicyComparatorimplementation.Only one of the
comparator class nameandcomparatorcan be configured in the eviction configuration.- Parameters:
comparator- the instance of the configuredEvictionPolicyComparatorimplementation- Returns:
- this EvictionConfig instance
- See Also:
-
getFactoryId
public int getFactoryId()Description copied from interface:IdentifiedDataSerializableReturns DataSerializableFactory factory ID for this class.- Specified by:
getFactoryIdin interfaceIdentifiedDataSerializable- Returns:
- factory ID
-
getClassId
public int getClassId()Description copied from interface:IdentifiedDataSerializableReturns type identifier for this class. It should be unique per DataSerializableFactory.- Specified by:
getClassIdin interfaceIdentifiedDataSerializable- Returns:
- type ID
-
writeData
Description copied from interface:DataSerializableWrites object fields to output stream- Specified by:
writeDatain interfaceDataSerializable- Parameters:
out- output- Throws:
IOException- if an I/O error occurs. In particular, anIOExceptionmay be thrown if the output stream has been closed.
-
readData
Description copied from interface:DataSerializableReads fields from the input stream- Specified by:
readDatain interfaceDataSerializable- Parameters:
in- input- Throws:
IOException- if an I/O error occurs. In particular, anIOExceptionmay be thrown if the input stream has been closed.
-
toString
-
equals
-
hashCode
public final int hashCode()
-