public class EvictionConfig extends Object implements EvictionConfiguration, DataSerializable, Serializable
The default values of the eviction configuration are
EvictionPolicy.LRU
as eviction policyEvictionConfig.MaxSizePolicy.ENTRY_COUNT
as max size policyIMap
Modifier and Type | Class and Description |
---|---|
static class |
EvictionConfig.MaxSizePolicy
Maximum Size Policy
|
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 int |
DEFAULT_MAX_ENTRY_COUNT_FOR_ON_HEAP_MAP
Default maximum entry count for Map on-heap Near Caches.
|
static EvictionConfig.MaxSizePolicy |
DEFAULT_MAX_SIZE_POLICY
Default Max-Size Policy.
|
protected EvictionPolicy |
evictionPolicy |
protected EvictionConfig.MaxSizePolicy |
maxSizePolicy |
protected EvictionConfig |
readOnly |
protected int |
size |
Constructor and Description |
---|
EvictionConfig() |
EvictionConfig(EvictionConfig config) |
EvictionConfig(int size,
EvictionConfig.MaxSizePolicy maxSizePolicy,
EvictionPolicy evictionPolicy) |
EvictionConfig(int size,
EvictionConfig.MaxSizePolicy maxSizePolicy,
EvictionPolicyComparator comparator) |
EvictionConfig(int size,
EvictionConfig.MaxSizePolicy maxSizePolicy,
String comparatorClassName) |
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object o) |
EvictionConfig |
getAsReadOnly()
Deprecated.
this method will be removed in 4.0; it is meant for internal usage only
|
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. |
EvictionPolicyType |
getEvictionPolicyType()
Deprecated.
since 3.9, please use
getEvictionPolicy() |
EvictionStrategyType |
getEvictionStrategyType()
Returns the
EvictionStrategyType of this eviction configuration. |
EvictionConfig.MaxSizePolicy |
getMaximumSizePolicy()
Returns the
EvictionConfig.MaxSizePolicy of this eviction configuration. |
int |
getSize()
Returns the size which is used by the
EvictionConfig.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 |
setMaximumSizePolicy(EvictionConfig.MaxSizePolicy maxSizePolicy)
Sets the
EvictionConfig.MaxSizePolicy of this eviction configuration. |
EvictionConfig |
setSize(int size)
Sets the size which is used by the
EvictionConfig.MaxSizePolicy . |
String |
toString() |
void |
writeData(ObjectDataOutput out)
Writes object fields to output stream
|
public static final int DEFAULT_MAX_ENTRY_COUNT
public static final int DEFAULT_MAX_ENTRY_COUNT_FOR_ON_HEAP_MAP
public static final EvictionConfig.MaxSizePolicy DEFAULT_MAX_SIZE_POLICY
public static final EvictionPolicy DEFAULT_EVICTION_POLICY
protected int size
protected EvictionConfig.MaxSizePolicy maxSizePolicy
protected EvictionPolicy evictionPolicy
protected String comparatorClassName
protected EvictionPolicyComparator comparator
protected EvictionConfig readOnly
public EvictionConfig()
public EvictionConfig(int size, EvictionConfig.MaxSizePolicy maxSizePolicy, EvictionPolicy evictionPolicy)
public EvictionConfig(int size, EvictionConfig.MaxSizePolicy maxSizePolicy, String comparatorClassName)
public EvictionConfig(int size, EvictionConfig.MaxSizePolicy maxSizePolicy, EvictionPolicyComparator comparator)
public EvictionConfig(EvictionConfig config)
public EvictionConfig getAsReadOnly()
public int getSize()
EvictionConfig.MaxSizePolicy
.
The interpretation of the value depends on the configured EvictionConfig.MaxSizePolicy
.
EvictionConfig.MaxSizePolicy
public EvictionConfig setSize(int size)
EvictionConfig.MaxSizePolicy
.
The interpretation of the value depends on the configured EvictionConfig.MaxSizePolicy
.
Accepts any positive number. The default value is 10000.
size
- the size which is used by the EvictionConfig.MaxSizePolicy
public EvictionConfig.MaxSizePolicy getMaximumSizePolicy()
EvictionConfig.MaxSizePolicy
of this eviction configuration.EvictionConfig.MaxSizePolicy
of this eviction configurationpublic EvictionConfig setMaximumSizePolicy(EvictionConfig.MaxSizePolicy maxSizePolicy)
EvictionConfig.MaxSizePolicy
of this eviction configuration.maxSizePolicy
- the EvictionConfig.MaxSizePolicy
of this eviction configurationpublic EvictionPolicy getEvictionPolicy()
EvictionPolicy
of this eviction configuration.getEvictionPolicy
in interface EvictionConfiguration
EvictionPolicy
of this eviction configurationpublic EvictionConfig setEvictionPolicy(EvictionPolicy evictionPolicy)
EvictionPolicy
of this eviction configuration.evictionPolicy
- the EvictionPolicy
of this eviction configurationpublic EvictionStrategyType getEvictionStrategyType()
EvictionStrategyType
of this eviction configuration.getEvictionStrategyType
in interface EvictionConfiguration
EvictionStrategyType
of this eviction configuration@Deprecated public EvictionPolicyType getEvictionPolicyType()
getEvictionPolicy()
EvictionPolicyType
of this eviction configuration.getEvictionPolicyType
in interface EvictionConfiguration
EvictionPolicyType
of this eviction configurationpublic String getComparatorClassName()
EvictionPolicyComparator
implementation.getComparatorClassName
in interface EvictionConfiguration
EvictionPolicyComparator
implementationpublic EvictionConfig setComparatorClassName(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 EvictionConfiguration
EvictionPolicyComparator
implementationpublic EvictionConfig setComparator(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
implementationpublic 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 © 2018 Hazelcast, Inc.. All Rights Reserved.