public class EvictionConfig extends Object implements com.hazelcast.internal.eviction.EvictionConfiguration, IdentifiedDataSerializable, Serializable
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 policyIMap
Modifier and Type | Field and 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 and Description |
---|
EvictionConfig() |
EvictionConfig(EvictionConfig config) |
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object o) |
int |
getClassId()
Returns type identifier for this class.
|
EvictionPolicyComparator |
getComparator()
Returns the instance of the configured
EvictionPolicyComparator implementation. |
String |
getComparatorClassName()
Returns the class name of the configured
EvictionPolicyComparator implementation. |
EvictionPolicy |
getEvictionPolicy()
Returns the
EvictionPolicy of this eviction configuration. |
com.hazelcast.internal.eviction.EvictionStrategyType |
getEvictionStrategyType()
Returns the
EvictionStrategyType of this eviction configuration. |
int |
getFactoryId()
Returns DataSerializableFactory factory ID for this class.
|
MaxSizePolicy |
getMaxSizePolicy()
Returns the
MaxSizePolicy of this eviction configuration. |
int |
getSize()
Returns the size which is used by the
MaxSizePolicy . |
int |
hashCode() |
void |
readData(ObjectDataInput in)
Reads fields from the input stream
|
EvictionConfig |
setComparator(EvictionPolicyComparator comparator)
Sets the instance of the configured
EvictionPolicyComparator implementation. |
EvictionConfig |
setComparatorClassName(String comparatorClassName)
Sets the class name of the configured
EvictionPolicyComparator implementation. |
EvictionConfig |
setEvictionPolicy(EvictionPolicy evictionPolicy)
Sets the
EvictionPolicy of this eviction configuration. |
EvictionConfig |
setMaxSizePolicy(MaxSizePolicy maxSizePolicy)
Sets the
MaxSizePolicy of this eviction configuration. |
EvictionConfig |
setSize(int size)
Sets the size which is used by the
MaxSizePolicy . |
String |
toString() |
void |
writeData(ObjectDataOutput out)
Writes object fields to output stream
|
public static final int DEFAULT_MAX_ENTRY_COUNT
public static final MaxSizePolicy DEFAULT_MAX_SIZE_POLICY
public static final EvictionPolicy DEFAULT_EVICTION_POLICY
protected int size
protected MaxSizePolicy maxSizePolicy
protected EvictionPolicy evictionPolicy
protected String comparatorClassName
protected EvictionPolicyComparator comparator
public EvictionConfig()
public EvictionConfig(EvictionConfig config)
public int getSize()
MaxSizePolicy
.
The interpretation of the value depends
on the configured MaxSizePolicy
.
MaxSizePolicy
public EvictionConfig setSize(int size)
MaxSizePolicy
.
The interpretation of the value depends
on the configured MaxSizePolicy
.
Accepts any non-negative number. The default value is 10000.
size
- the size which is used by the MaxSizePolicy
public MaxSizePolicy getMaxSizePolicy()
MaxSizePolicy
of this eviction configuration.MaxSizePolicy
of this eviction configurationpublic EvictionConfig setMaxSizePolicy(MaxSizePolicy maxSizePolicy)
MaxSizePolicy
of this eviction configuration.maxSizePolicy
- the MaxSizePolicy
of this eviction configurationpublic EvictionPolicy getEvictionPolicy()
EvictionPolicy
of this eviction configuration.getEvictionPolicy
in interface com.hazelcast.internal.eviction.EvictionConfiguration
EvictionPolicy
of this eviction configurationpublic EvictionConfig setEvictionPolicy(EvictionPolicy evictionPolicy)
EvictionPolicy
of this eviction configuration.evictionPolicy
- the EvictionPolicy
of this eviction configurationpublic com.hazelcast.internal.eviction.EvictionStrategyType getEvictionStrategyType()
EvictionStrategyType
of this eviction configuration.getEvictionStrategyType
in interface com.hazelcast.internal.eviction.EvictionConfiguration
EvictionStrategyType
of this eviction configurationpublic String getComparatorClassName()
EvictionPolicyComparator
implementation.getComparatorClassName
in interface com.hazelcast.internal.eviction.EvictionConfiguration
EvictionPolicyComparator
implementationpublic EvictionConfig setComparatorClassName(@Nonnull String comparatorClassName)
EvictionPolicyComparator
implementation.
Only one of the comparator class name
and comparator
can be configured in the eviction configuration.
comparatorClassName
- the class name of the
configured EvictionPolicyComparator
implementationpublic EvictionPolicyComparator getComparator()
EvictionPolicyComparator
implementation.getComparator
in interface com.hazelcast.internal.eviction.EvictionConfiguration
EvictionPolicyComparator
implementationpublic EvictionConfig setComparator(@Nonnull EvictionPolicyComparator comparator)
EvictionPolicyComparator
implementation.
Only one of the comparator class name
and comparator
can be configured in the eviction configuration.
comparator
- the instance of the configured
EvictionPolicyComparator
implementationMapEvictionPolicyComparator
,
CacheEvictionPolicyComparator
public int getFactoryId()
IdentifiedDataSerializable
getFactoryId
in interface IdentifiedDataSerializable
public int getClassId()
IdentifiedDataSerializable
getClassId
in interface IdentifiedDataSerializable
public void writeData(ObjectDataOutput out) throws IOException
DataSerializable
writeData
in interface DataSerializable
out
- outputIOException
- if an I/O error occurs. In particular,
an IOException
may be thrown if the
output stream has been closed.public void readData(ObjectDataInput in) throws IOException
DataSerializable
readData
in interface DataSerializable
in
- inputIOException
- if an I/O error occurs. In particular,
an IOException
may be thrown if the
input stream has been closed.Copyright © 2023 Hazelcast, Inc.. All rights reserved.