Record Class MapStoreConfig
java.lang.Object
java.lang.Record
com.loomcache.server.datastructures.mapstore.MapStoreConfig
- Record Components:
writeThrough- whentrue, every write synchronously invokesMapStore.store(Object, Object)/MapStore.delete(Object)in the critical path (deferred-side-effect style: after the transaction lock releases, but before the caller is notified)writeBehind- whentrue, writes are coalesced into a bounded queue and flushed periodically on a virtual-thread scheduler; same-key updates collapsewriteBatchSize- maximum batch size per flush cycle (write-behind only); must be > 0writeDelay- time between flush cycles (write-behind only); must be >Duration.ZEROloadMode- controls whetherMapStore.loadAllKeys()is invoked at wire-up time (EAGER) or only on get-miss (LAZY)
public record MapStoreConfig(boolean writeThrough, boolean writeBehind, int writeBatchSize, Duration writeDelay, MapStoreConfig.LoadMode loadMode)
extends Record
Configuration for wiring a
MapStore into a
DistributedMap.
Exactly one of writeThrough and writeBehind may be true
(enabling both is nonsensical and rejected at construction).
-
Nested Class Summary
Nested Classes -
Constructor Summary
ConstructorsConstructorDescriptionMapStoreConfig(boolean writeThrough, boolean writeBehind, int writeBatchSize, Duration writeDelay, MapStoreConfig.LoadMode loadMode) Compact-constructor validation. -
Method Summary
Modifier and TypeMethodDescriptionstatic MapStoreConfigdefaults()Sensible defaults: write-through, LAZY load, 100-entry batches, 1-second flush interval.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.loadMode()Returns the value of theloadModerecord component.final StringtoString()Returns a string representation of this record class.intReturns the value of thewriteBatchSizerecord component.booleanReturns the value of thewriteBehindrecord component.static MapStoreConfigwriteBehindConfig(int batchSize, Duration delay) Convenience factory for write-behind mode.Returns the value of thewriteDelayrecord component.booleanReturns the value of thewriteThroughrecord component.static MapStoreConfigConvenience factory for write-through mode.static MapStoreConfigConvenience factory for write-through persistence without read-through loading.
-
Constructor Details
-
MapStoreConfig
public MapStoreConfig(boolean writeThrough, boolean writeBehind, int writeBatchSize, Duration writeDelay, MapStoreConfig.LoadMode loadMode) Compact-constructor validation.
-
-
Method Details
-
defaults
Sensible defaults: write-through, LAZY load, 100-entry batches, 1-second flush interval.- Returns:
- the default configuration
-
writeBehindConfig
Convenience factory for write-behind mode.- Parameters:
batchSize- maximum entries per flush batchdelay- flush interval- Returns:
- a write-behind configuration
-
writeThroughConfig
Convenience factory for write-through mode.- Returns:
- a write-through configuration
-
writeThroughNoLoadConfig
Convenience factory for write-through persistence without read-through loading.- Returns:
- a write-through configuration with backing-store reads disabled
-
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. -
writeThrough
public boolean writeThrough()Returns the value of thewriteThroughrecord component.- Returns:
- the value of the
writeThroughrecord component
-
writeBehind
public boolean writeBehind()Returns the value of thewriteBehindrecord component.- Returns:
- the value of the
writeBehindrecord component
-
writeBatchSize
public int writeBatchSize()Returns the value of thewriteBatchSizerecord component.- Returns:
- the value of the
writeBatchSizerecord component
-
writeDelay
Returns the value of thewriteDelayrecord component.- Returns:
- the value of the
writeDelayrecord component
-
loadMode
-