Class EmbeddedLoomCacheBuilder
java.lang.Object
com.loomcache.server.embedded.EmbeddedLoomCacheBuilder
Builder for EmbeddedLoomCache instances.
Provides fluent configuration with sensible defaults: - Standalone mode by default (no clustering) - Hazelcast-compatible cluster name, member port, and unbounded map defaults - REST API disabled by default - In-process data structures - Thread-safe access
Example usage:
EmbeddedLoomCache cache = EmbeddedLoomCache.builder()
.port(5701)
.dataDir("./data")
.enableRest(8080)
.build();
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbuild()Build the EmbeddedLoomCache instance.clusterName(String name) Set the cluster name (default: dev).Set the data directory for persistence (default: persistence).Set the data directory for persistence (default: persistence).enablePersistence(boolean enable) Enable persistence (default: false).enableRest(int port) Enable the REST API on the specified port.evictionPolicy(String policy) Set the map eviction policy (default: NONE).Set the advertised host address for cluster communication.joinCluster(String... seeds) Join a cluster with the specified seed nodes.maxMapEntries(int max) Set maximum number of map entries (default: 0 = unbounded).maxMemoryBytes(long bytes) Set maximum memory in bytes (default: unbounded).Set the node ID.port(int port) Set the TCP port for cluster communication (default: 5701).readBackupData(boolean enabled) Enable local backup reads for embedded/member-local read operations.Configure standalone mode (single-node, no clustering).
-
Constructor Details
-
EmbeddedLoomCacheBuilder
public EmbeddedLoomCacheBuilder()
-
-
Method Details
-
nodeId
Set the node ID. -
dataDir
Set the data directory for persistence (default: persistence). -
dataDir
Set the data directory for persistence (default: persistence). -
clusterName
Set the cluster name (default: dev). -
port
Set the TCP port for cluster communication (default: 5701). -
host
Set the advertised host address for cluster communication. When omitted, standalone mode uses loopback and clustered mode resolves a non-loopback local address automatically. -
enableRest
Enable the REST API on the specified port.- Parameters:
port- the port for the REST API (or -1 to disable)
-
standalone
Configure standalone mode (single-node, no clustering). This is the default. -
joinCluster
Join a cluster with the specified seed nodes.- Parameters:
seeds- comma-separated seed node addresses (e.g., "localhost:5701,localhost:5702")
-
enablePersistence
Enable persistence (default: false). -
maxMapEntries
Set maximum number of map entries (default: 0 = unbounded). -
evictionPolicy
Set the map eviction policy (default: NONE). -
maxMemoryBytes
Set maximum memory in bytes (default: unbounded). -
readBackupData
Enable local backup reads for embedded/member-local read operations. Reads may be stale while replication or leader failover is in progress. -
build
Build the EmbeddedLoomCache instance.
-