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.LRU
as eviction policyMaxSizePolicy.ENTRY_COUNT
as max size policy- 2147483647 as maximum
size for on-heap
IMap
- 10000 as maximum size for all other data structures and configurations
- See Also:
- Serialized Form
-
Field Summary
Fields Modifier and Type Field Description protected EvictionPolicyComparator
comparator
protected String
comparatorClassName
static EvictionPolicy
DEFAULT_EVICTION_POLICY
Default Eviction Policy.static int
DEFAULT_MAX_ENTRY_COUNT
Default maximum entry count.static MaxSizePolicy
DEFAULT_MAX_SIZE_POLICY
Default Max-Size Policy.protected EvictionPolicy
evictionPolicy
protected MaxSizePolicy
maxSizePolicy
protected int
size
-
Constructor Summary
Constructors Constructor Description EvictionConfig()
EvictionConfig(EvictionConfig config)
-
Method Summary
Modifier and Type Method Description boolean
equals(Object o)
int
getClassId()
Returns type identifier for this class.EvictionPolicyComparator
getComparator()
Returns the instance of the configuredEvictionPolicyComparator
implementation.String
getComparatorClassName()
Returns the class name of the configuredEvictionPolicyComparator
implementation.EvictionPolicy
getEvictionPolicy()
Returns theEvictionPolicy
of this eviction configuration.com.hazelcast.internal.eviction.EvictionStrategyType
getEvictionStrategyType()
Returns theEvictionStrategyType
of this eviction configuration.int
getFactoryId()
Returns DataSerializableFactory factory ID for this class.MaxSizePolicy
getMaxSizePolicy()
Returns theMaxSizePolicy
of this eviction configuration.int
getSize()
Returns the size which is used by theMaxSizePolicy
.int
hashCode()
void
readData(ObjectDataInput in)
Reads fields from the input streamEvictionConfig
setComparator(EvictionPolicyComparator comparator)
Sets the instance of the configuredEvictionPolicyComparator
implementation.EvictionConfig
setComparatorClassName(String comparatorClassName)
Sets the class name of the configuredEvictionPolicyComparator
implementation.EvictionConfig
setEvictionPolicy(EvictionPolicy evictionPolicy)
Sets theEvictionPolicy
of this eviction configuration.EvictionConfig
setMaxSizePolicy(MaxSizePolicy maxSizePolicy)
Sets theMaxSizePolicy
of this eviction configuration.EvictionConfig
setSize(int size)
Sets the size which is used by theMaxSizePolicy
.String
toString()
void
writeData(ObjectDataOutput out)
Writes object fields to output stream
-
Field Details
-
DEFAULT_MAX_ENTRY_COUNT
public static final int DEFAULT_MAX_ENTRY_COUNTDefault maximum entry count.- See Also:
- Constant Field Values
-
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 theMaxSizePolicy
of this eviction configuration.- Returns:
- the
MaxSizePolicy
of this eviction configuration
-
setMaxSizePolicy
Sets theMaxSizePolicy
of this eviction configuration.- Parameters:
maxSizePolicy
- theMaxSizePolicy
of this eviction configuration- Returns:
- this EvictionConfig instance
-
getEvictionPolicy
Returns theEvictionPolicy
of this eviction configuration.- Specified by:
getEvictionPolicy
in interfacecom.hazelcast.internal.eviction.EvictionConfiguration
- Returns:
- the
EvictionPolicy
of this eviction configuration
-
setEvictionPolicy
Sets theEvictionPolicy
of this eviction configuration.- Parameters:
evictionPolicy
- theEvictionPolicy
of this eviction configuration- Returns:
- this EvictionConfig instance
-
getEvictionStrategyType
public com.hazelcast.internal.eviction.EvictionStrategyType getEvictionStrategyType()Returns theEvictionStrategyType
of this eviction configuration.- Specified by:
getEvictionStrategyType
in interfacecom.hazelcast.internal.eviction.EvictionConfiguration
- Returns:
- the
EvictionStrategyType
of this eviction configuration
-
getComparatorClassName
Returns the class name of the configuredEvictionPolicyComparator
implementation.- Specified by:
getComparatorClassName
in interfacecom.hazelcast.internal.eviction.EvictionConfiguration
- Returns:
- the class name of the configured
EvictionPolicyComparator
implementation
-
setComparatorClassName
Sets the class name of the configuredEvictionPolicyComparator
implementation.Only one of the
comparator class name
andcomparator
can be configured in the eviction configuration.- Parameters:
comparatorClassName
- the class name of the configuredEvictionPolicyComparator
implementation- Returns:
- this EvictionConfig instance
-
getComparator
Returns the instance of the configuredEvictionPolicyComparator
implementation.- Specified by:
getComparator
in interfacecom.hazelcast.internal.eviction.EvictionConfiguration
- Returns:
- the instance of the configured
EvictionPolicyComparator
implementation
-
setComparator
Sets the instance of the configuredEvictionPolicyComparator
implementation.Only one of the
comparator class name
andcomparator
can be configured in the eviction configuration.- Parameters:
comparator
- the instance of the configuredEvictionPolicyComparator
implementation- Returns:
- this EvictionConfig instance
- See Also:
MapEvictionPolicyComparator
,CacheEvictionPolicyComparator
-
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
Description copied from interface:DataSerializable
Writes object fields to output stream- Specified by:
writeData
in interfaceDataSerializable
- Parameters:
out
- output- Throws:
IOException
- if an I/O error occurs. In particular, anIOException
may be thrown if the output stream has been closed.
-
readData
Description copied from interface:DataSerializable
Reads fields from the input stream- Specified by:
readData
in interfaceDataSerializable
- Parameters:
in
- input- Throws:
IOException
- if an I/O error occurs. In particular, anIOException
may be thrown if the input stream has been closed.
-
toString
-
equals
-
hashCode
public final int hashCode()
-