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:
-
Field Summary
Modifier and TypeFieldDescriptionprotected EvictionPolicyComparator
protected String
static final EvictionPolicy
Default Eviction Policy.static final int
Default maximum entry count.static final MaxSizePolicy
Default Max-Size Policy.protected EvictionPolicy
protected MaxSizePolicy
protected int
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionfinal boolean
int
Returns type identifier for this class.Returns the instance of the configuredEvictionPolicyComparator
implementation.Returns the class name of the configuredEvictionPolicyComparator
implementation.Returns theEvictionPolicy
of this eviction configuration.com.hazelcast.internal.eviction.EvictionStrategyType
Returns theEvictionStrategyType
of this eviction configuration.int
Returns DataSerializableFactory factory ID for this class.Returns theMaxSizePolicy
of this eviction configuration.int
getSize()
Returns the size which is used by theMaxSizePolicy
.final int
hashCode()
void
Reads fields from the input streamsetComparator
(EvictionPolicyComparator comparator) Sets the instance of the configuredEvictionPolicyComparator
implementation.setComparatorClassName
(String comparatorClassName) Sets the class name of the configuredEvictionPolicyComparator
implementation.setEvictionPolicy
(EvictionPolicy evictionPolicy) Sets theEvictionPolicy
of this eviction configuration.setMaxSizePolicy
(MaxSizePolicy maxSizePolicy) Sets theMaxSizePolicy
of this eviction configuration.setSize
(int size) Sets the size which is used by theMaxSizePolicy
.toString()
void
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:
-
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:
-
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()
-