Class EmbeddedLoomCache
java.lang.Object
com.loomcache.server.embedded.EmbeddedLoomCache
- All Implemented Interfaces:
AutoCloseable
In-process cache instance for embedded LoomCache usage.
Features: - No network overhead for in-process access - Builder pattern for configuration - Thread-safe access to all data structures - Optional REST API for external access - Standalone or cluster-aware mode - Direct Java API (no network serialization)
Usage:
EmbeddedLoomCache cache = EmbeddedLoomCache.builder()
.dataDir("./data")
.standalone()
.build();
cache.start();
DistributedMapinvalid input: '<'String, String> map = cache.getMap("myMap");
map.put("key1", "value1");
cache.shutdown();
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedEmbeddedLoomCache(String nodeId, Path dataDir, String clusterName, int port, int restPort, boolean standalone, List<String> seedNodes, @Nullable String advertisedHost, boolean enablePersistence, int maxMapEntries, String mapEvictionPolicy, long maxMemoryBytes, boolean readBackupData) -
Method Summary
Modifier and TypeMethodDescriptionstatic EmbeddedLoomCacheBuilderbuilder()Create a new builder for EmbeddedLoomCache.voidclose()Get or create a distributed map.Get or create a distributed queue.Get or create a distributed set.Get or create a distributed topic.booleanCheck if REST API is enabled.voidshutdown()Shut down the embedded cache gracefully.voidstart()Start the embedded cache.
-
Constructor Details
-
EmbeddedLoomCache
-
-
Method Details
-
start
-
shutdown
public void shutdown()Shut down the embedded cache gracefully. -
getMap
Get or create a distributed map.- Parameters:
name- the map name- Returns:
- the distributed map
-
getQueue
Get or create a distributed queue.- Parameters:
name- the queue name- Returns:
- the distributed queue
-
getSet
Get or create a distributed set.- Parameters:
name- the set name- Returns:
- the distributed set
-
getTopic
Get or create a distributed topic.- Parameters:
name- the topic name- Returns:
- the distributed topic
-
isRestEnabled
public boolean isRestEnabled()Check if REST API is enabled. -
builder
Create a new builder for EmbeddedLoomCache. -
close
public void close()- Specified by:
closein interfaceAutoCloseable
-