Package com.hazelcast.config
Class EvictionConfig
java.lang.Object
com.hazelcast.config.EvictionConfig
- All Implemented Interfaces:
com.hazelcast.internal.eviction.EvictionConfiguration
,Serializable
public class EvictionConfig
extends Object
implements com.hazelcast.internal.eviction.EvictionConfiguration, 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
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.Returns theMaxSizePolicy
of this eviction configuration.int
getSize()
Returns the size which is used by theMaxSizePolicy
.final int
hashCode()
setComparator
(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()
-
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
-
toString
-
equals
-
hashCode
public final int hashCode()
-