Record Class DistributedMapConfig
java.lang.Object
java.lang.Record
com.loomcache.server.datastructures.DistributedMapConfig
public record DistributedMapConfig(int maxSize, DistributedMapConfig.EvictionPolicy evictionPolicy, boolean metricsEnabled, long maxIdleMillis)
extends Record
Per-map configuration for a
DistributedMap instance.
Uses a builder so operators can tune per-map behavior before deployment:
var config = DistributedMapConfig.builder()
.maxSize(10_000)
.evictionPolicy(EvictionPolicy.LRU)
.build();
var map = new DistributedMap<>("sessions", 1, config);
Immutable after construction — safe to share across threads.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classFluent builder forDistributedMapConfig.static enumEviction policy applied when the map reachesmaxSize. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final DistributedMapConfigDefault config: unbounded, no eviction, metrics enabled, no max-idle expiry. -
Constructor Summary
ConstructorsConstructorDescriptionDistributedMapConfig(int maxSize, DistributedMapConfig.EvictionPolicy evictionPolicy, boolean metricsEnabled) DistributedMapConfig(int maxSize, DistributedMapConfig.EvictionPolicy evictionPolicy, boolean metricsEnabled, long maxIdleMillis) Creates an instance of aDistributedMapConfigrecord class. -
Method Summary
Modifier and TypeMethodDescriptionstatic DistributedMapConfig.Builderbuilder()final booleanIndicates whether some other object is "equal to" this one.Returns the value of theevictionPolicyrecord component.final inthashCode()Returns a hash code value for this object.booleanTrue if this config expires entries that have not been accessed recently.booleanTrue if this config enforces a size limit.longReturns the value of themaxIdleMillisrecord component.intmaxSize()Returns the value of themaxSizerecord component.booleanReturns the value of themetricsEnabledrecord component.final StringtoString()Returns a string representation of this record class.
-
Field Details
-
DEFAULT
Default config: unbounded, no eviction, metrics enabled, no max-idle expiry.
-
-
Constructor Details
-
DistributedMapConfig
public DistributedMapConfig(int maxSize, DistributedMapConfig.EvictionPolicy evictionPolicy, boolean metricsEnabled, long maxIdleMillis) Creates an instance of aDistributedMapConfigrecord class.- Parameters:
maxSize- the value for themaxSizerecord componentevictionPolicy- the value for theevictionPolicyrecord componentmetricsEnabled- the value for themetricsEnabledrecord componentmaxIdleMillis- the value for themaxIdleMillisrecord component
-
DistributedMapConfig
public DistributedMapConfig(int maxSize, DistributedMapConfig.EvictionPolicy evictionPolicy, boolean metricsEnabled)
-
-
Method Details
-
hasSizeLimit
public boolean hasSizeLimit()True if this config enforces a size limit. -
hasMaxIdle
public boolean hasMaxIdle()True if this config expires entries that have not been accessed recently. -
builder
-
toString
-
hashCode
-
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with thecomparemethod from their corresponding wrapper classes. -
maxSize
public int maxSize()Returns the value of themaxSizerecord component.- Returns:
- the value of the
maxSizerecord component
-
evictionPolicy
Returns the value of theevictionPolicyrecord component.- Returns:
- the value of the
evictionPolicyrecord component
-
metricsEnabled
public boolean metricsEnabled()Returns the value of themetricsEnabledrecord component.- Returns:
- the value of the
metricsEnabledrecord component
-
maxIdleMillis
public long maxIdleMillis()Returns the value of themaxIdleMillisrecord component.- Returns:
- the value of the
maxIdleMillisrecord component
-